fix: include admins

v1.18.x
gasoved 4 years ago committed by Julian Lam
parent a2a7557cc0
commit 7c9674de6c

@ -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]]'));
}

Loading…
Cancel
Save