Remove toast from showing up when grabbing legacy video data

This commit is contained in:
PrestonN 2019-03-28 13:36:18 -04:00
parent 48436e50b3
commit ee25f31938
2 changed files with 11 additions and 7 deletions

View File

@ -58,11 +58,13 @@ function addToHistory(data){
*
* @return {Void}
*/
function removeFromHistory(videoId){
function removeFromHistory(videoId, toast = true){
const data = {videoId: videoId};
historyDb.remove(data, {}, (err, numRemoved) => {
if (!err) {
showToast('Video removed from history');
if (toast) {
if (!err) {
showToast('Video removed from history');
}
}
});
}
@ -106,7 +108,7 @@ function showHistory(){
videoData.position = index;
displayVideo(videoData, 'history');
}, () => {
removeFromHistory(video.videoId);
removeFromHistory(video.videoId, false);
});
}
else{

View File

@ -70,11 +70,13 @@ function addSavedVideo(videoId) {
*
* @return {Void}
*/
function removeSavedVideo(videoId, string) {
function removeSavedVideo(videoId, toast = true) {
savedVidsDb.remove({
videoId: videoId
}, {}, (err, numRemoved) => {
showToast('Video has been removed from the favorites list.');
if (toast) {
showToast('Video has been removed from the favorites list.');
}
if (savedView.seen === true) {
showSavedVideos();
}
@ -169,7 +171,7 @@ function showSavedVideos() {
videoData.position = index;
displayVideo(videoData, 'saved');
}, () => {
removeSavedVideo(video.videoId);
removeSavedVideo(video.videoId, false);
});
}
else {