|
|
|
@ -101,9 +101,12 @@ Posts.deleteDiff = async (req, res) => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const cid = await posts.getCidByPid(req.params.pid);
|
|
|
|
|
const isModerator = privileges.users.isModerator(cid, req.uid);
|
|
|
|
|
const [isAdmin, isModerator] = await Promise.all([
|
|
|
|
|
privileges.users.isAdministrator(req.uid),
|
|
|
|
|
privileges.users.isModerator(req.uid, cid),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
if (!isModerator) {
|
|
|
|
|
if (!(isAdmin || isModerator)) {
|
|
|
|
|
return helpers.formatApiResponse(403, res, new Error('[[error:no-privileges]]'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|