fixup! Add fix for missing deletion of notes on user-deletion request

This commit is contained in:
Sheogorath 2020-03-21 18:13:20 +01:00
parent 1ed522bd85
commit 4884292b68
No known key found for this signature in database
GPG key ID: C9B1C80737B9CE18

View file

@ -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) process.exit(0)
} }