summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSheogorath2020-03-21 18:13:20 +0100
committerSheogorath2020-03-21 18:13:20 +0100
commit4884292b68c7b5bcf086b6322d8c74f542fc96dc (patch)
tree35256cb4e229c9421fd70da58f39135214a01b6e /bin
parent1ed522bd8571d9fc846355ba0505f40b9d9415c2 (diff)
fixup! Add fix for missing deletion of notes on user-deletion request
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cleanup17
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)
}