From 7ee4e4e004c4f40a16fbd3417a3ea9b60765fb81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Wed, 2 Mar 2022 15:00:27 -0500 Subject: [PATCH] fix: #10357 --- src/categories/topics.js | 2 +- src/controllers/accounts/posts.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/categories/topics.js b/src/categories/topics.js index fdba6ab59d..020713aabe 100644 --- a/src/categories/topics.js +++ b/src/categories/topics.js @@ -163,7 +163,7 @@ module.exports = function (Categories) { if (!topic.scheduled && topic.deleted && !topic.isOwner) { topic.title = '[[topic:topic_is_deleted]]'; if (topic.hasOwnProperty('titleRaw')) { - topics.titleRaw = '[[topic:topic_is_deleted]]'; + topic.titleRaw = '[[topic:topic_is_deleted]]'; } topic.slug = topic.tid; topic.teaser = null; diff --git a/src/controllers/accounts/posts.js b/src/controllers/accounts/posts.js index a43a70ccd4..94bc2d9169 100644 --- a/src/controllers/accounts/posts.js +++ b/src/controllers/accounts/posts.js @@ -5,6 +5,7 @@ const user = require('../../user'); const posts = require('../../posts'); const topics = require('../../topics'); const categories = require('../../categories'); +const privileges = require('../../privileges'); const pagination = require('../../pagination'); const helpers = require('../helpers'); const accountHelpers = require('./helpers'); @@ -56,7 +57,8 @@ const templateToData = { return cids.map(c => `cid:${c}:uid:${userData.uid}:pids:votes`); }, getTopics: async (sets, req, start, stop) => { - const pids = await db.getSortedSetRevRangeByScore(sets, start, stop - start + 1, '+inf', 1); + let pids = await db.getSortedSetRevRangeByScore(sets, start, stop - start + 1, '+inf', 1); + pids = await privileges.posts.filter('topics:read', pids, req.uid); const postObjs = await posts.getPostSummaryByPids(pids, req.uid, { stripTags: false }); return { posts: postObjs, nextStart: stop + 1 }; }, @@ -74,7 +76,8 @@ const templateToData = { return cids.map(c => `cid:${c}:uid:${userData.uid}:pids:votes`); }, getTopics: async (sets, req, start, stop) => { - const pids = await db.getSortedSetRangeByScore(sets, start, stop - start + 1, '-inf', -1); + let pids = await db.getSortedSetRangeByScore(sets, start, stop - start + 1, '-inf', -1); + pids = await privileges.posts.filter('topics:read', pids, req.uid); const postObjs = await posts.getPostSummaryByPids(pids, req.uid, { stripTags: false }); return { posts: postObjs, nextStart: stop + 1 }; },