Fixed bug where subscriptions may register the same file multiple times

This commit is contained in:
Isaac Abadi
2020-08-09 14:07:36 -04:00
parent c6c80579df
commit 59ad74ed79

View File

@@ -61,6 +61,10 @@ function registerFileDB(file_path, type, multiUserMode = null, sub = null) {
} else {
sub_db = db.get('subscriptions').find({id: sub.id});
}
if (sub_db.get('videos').find({id: file_object.id}).value()) {
logger.verbose(`Subscription video ${file_object.id} already exists, skipping DB registration.`);
return null;
}
sub_db.get('videos').push(file_object).write();
}