From c843984d57cc53df6a72cf50a2ebbdebf6e5e156 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 17 Mar 2023 00:33:17 -0400 Subject: [PATCH] fix: #11362, regular mods are also subject to post queue [breaking] --- src/controllers/mods.js | 14 ++++++++++---- src/views/post-queue.tpl | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/controllers/mods.js b/src/controllers/mods.js index 1592acdecd..7db3151e42 100644 --- a/src/controllers/mods.js +++ b/src/controllers/mods.js @@ -210,9 +210,15 @@ modsController.postQueue = async function (req, res, next) { helpers.getSelectedCategory(cid), ]); - postData = postData.filter(p => p && - (!categoriesData.selectedCids.length || categoriesData.selectedCids.includes(p.category.cid)) && - (isAdmin || isGlobalMod || moderatedCids.includes(Number(p.category.cid)) || req.uid === p.user.uid)); + postData = postData + .filter(p => p && + (!categoriesData.selectedCids.length || categoriesData.selectedCids.includes(p.category.cid)) && + (isAdmin || isGlobalMod || moderatedCids.includes(Number(p.category.cid)) || req.uid === p.user.uid)) + .map((post) => { + const isSelf = post.user.uid === req.uid; + post.canAccept = !isSelf && (isAdmin || isGlobalMod || !!moderatedCids.length); + return post; + }); ({ posts: postData } = await plugins.hooks.fire('filter:post-queue.get', { posts: postData, @@ -232,7 +238,7 @@ modsController.postQueue = async function (req, res, next) { title: '[[pages:post-queue]]', posts: postData, isAdmin: isAdmin, - canAccept: isAdmin || isGlobalMod || !!moderatedCids.length, + canAccept: isAdmin || isGlobalMod, ...categoriesData, allCategoriesUrl: `post-queue${helpers.buildQueryString(req.query, 'cid', '')}`, pagination: pagination.create(page, pageCount), diff --git a/src/views/post-queue.tpl b/src/views/post-queue.tpl index e2e891d792..e5e51d7d75 100644 --- a/src/views/post-queue.tpl +++ b/src/views/post-queue.tpl @@ -102,7 +102,7 @@