This commit is contained in:
Tom Moor
2023-07-23 17:50:33 -04:00
parent 72adcd10ef
commit f8927ff819

View File

@@ -89,13 +89,14 @@ router.post(
const comment = await Comment.findByPk(id, {
transaction,
rejectOnEmpty: true,
lock: {
level: transaction.LOCK.UPDATE,
of: Comment,
},
});
const document = await Document.findByPk(comment.documentId, {
userId: user.id
userId: user.id,
});
authorize(user, "comment", document);
authorize(user, "update", comment);
@@ -127,9 +128,10 @@ router.post(
const comment = await Comment.findByPk(id, {
transaction,
rejectOnEmpty: true,
});
const document = await Document.findByPk(comment.documentId, {
userId: user.id
userId: user.id,
});
authorize(user, "comment", document);
authorize(user, "delete", comment);