Allow workspace admins to remove comments (#5270)

This commit is contained in:
Tom Moor
2023-04-27 21:34:01 -04:00
committed by GitHub
parent ef075c0fa2
commit 4dade03c33
2 changed files with 6 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
import Router from "koa-router";
import { Transaction } from "sequelize";
import commentCreator from "@server/commands/commentCreator";
import commentDestroyer from "@server/commands/commentDestroyer";
import commentUpdater from "@server/commands/commentUpdater";
@@ -122,9 +121,8 @@ router.post(
const { user } = ctx.state.auth;
const { transaction } = ctx.state;
const comment = await Comment.unscoped().findByPk(id, {
const comment = await Comment.findByPk(id, {
transaction,
lock: Transaction.LOCK.UPDATE,
});
authorize(user, "delete", comment);