From 4884292b68c7b5bcf086b6322d8c74f542fc96dc Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 21 Mar 2020 18:13:20 +0100 Subject: [PATCH] fixup! Add fix for missing deletion of notes on user-deletion request --- bin/cleanup | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/bin/cleanup b/bin/cleanup index e2776bb75..a25a8320c 100755 --- a/bin/cleanup +++ b/bin/cleanup @@ -50,6 +50,23 @@ async function cleanup() { } } }) + await models.Revision.findAll({ + include: [{ + model: models.Note, + as: 'note' + }] + }).then(async function(revisions) { + for(let i =0, revisionCount = revisions.length; i< revisionCount; i++) { + const item = revisions[i] + if(item.noteId != null && !item.note) { + await models.Revision.destroy({ + where: { + id: item.id + }}) + logger.info(`Deleted revision ${item.id} from note ${item.userId}`) + } + } + }) process.exit(0) }