Skip to content

Node.js based forum software built for the modern web

fix: #11136, only show mods of active categories when getModeratorUids is called

Julian Lam39e009c05af9
diff --git a/src/categories/index.js b/src/categories/index.js
index 5789c25e37..45ad28704a 100644
--- a/src/categories/index.js
+++ b/src/categories/index.js
@@ -99,6 +99,10 @@ Categories.getModerators = async function (cid) {
};
Categories.getModeratorUids = async function (cids) {
+ // Only check active categories
+ const disabled = (await Categories.getCategoriesFields(cids, ['disabled'])).map(obj => obj.disabled);
+ cids = cids.filter((_, idx) => !disabled[idx]);
+
const groupNames = cids.reduce((memo, cid) => {
memo.push(`cid:${cid}:privileges:moderate`);
memo.push(`cid:${cid}:privileges:groups:moderate`);