diff options
author | Sheogorath | 2020-03-21 18:13:20 +0100 |
---|---|---|
committer | Sheogorath | 2020-03-21 18:13:20 +0100 |
commit | 4884292b68c7b5bcf086b6322d8c74f542fc96dc (patch) | |
tree | 35256cb4e229c9421fd70da58f39135214a01b6e /bin | |
parent | 1ed522bd8571d9fc846355ba0505f40b9d9415c2 (diff) |
fixup! Add fix for missing deletion of notes on user-deletion request
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cleanup | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/cleanup b/bin/cleanup index e2776bb7..a25a8320 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) } |