Skip to content

Node.js based forum software built for the modern web

fix: send guests to login page if they access uncategorized topics without local posts

Julian Lamb4f8e20b4c32
diff --git a/src/controllers/topics.js b/src/controllers/topics.js
index 178c38c869..23a03d87e5 100644
--- a/src/controllers/topics.js
+++ b/src/controllers/topics.js
@@ -53,12 +53,16 @@ topicsController.get = async function getTopic(req, res, next) {
if (
userPrivileges.disabled ||
invalidPagination ||
- (topicData.scheduled && !userPrivileges.view_scheduled) ||
- await shouldHideTopicFromGuest(req.uid, tid, topicData.cid)) {
+ (topicData.scheduled && !userPrivileges.view_scheduled)
+ ) {
return next();
}
- if (!userPrivileges['topics:read'] || (!topicData.scheduled && topicData.deleted && !userPrivileges.view_deleted)) {
+ if (
+ !userPrivileges['topics:read'] ||
+ (!topicData.scheduled && topicData.deleted && !userPrivileges.view_deleted) ||
+ await shouldHideTopicFromGuest(req.uid, tid, topicData.cid)
+ ) {
return helpers.notAllowed(req, res);
}