Skip to content

Node.js based forum software built for the modern web

refactor: use topic.cid and check for falsy values

Barış Soner Uşaklıd3eecfb07d53
diff --git a/src/controllers/mods.js b/src/controllers/mods.js
index de2a8bcaea..8714d1762a 100644
--- a/src/controllers/mods.js
+++ b/src/controllers/mods.js
@@ -234,8 +234,8 @@ modsController.postQueue = async function (req, res, next) {
postData = postData
.filter(p => p &&
- (!categoriesData.selectedCids.length || categoriesData.selectedCids.includes(p.category.cid)) &&
- (isAdmin || isGlobalMod || moderatedCids.map(String).includes(String(p.category.cid)) || req.uid === p.user.uid))
+ (!categoriesData.selectedCids.length || categoriesData.selectedCids.includes(p.topic?.cid)) &&
+ (isAdmin || isGlobalMod || moderatedCids.map(String).includes(String(p.topic?.cid)) || req.uid === p.user.uid))
.map((post) => {
const isSelf = post.user.uid === req.uid;
post.canAccept = !isSelf && (isAdmin || isGlobalMod || !!moderatedCids.length);