fix: dont show deleted posts in navigator

This commit is contained in:
Barış Soner Uşaklı
2020-12-22 14:29:25 -05:00
parent 32e36f7b2e
commit 931105e6cb

View File

@@ -86,12 +86,13 @@ SocketPosts.getPostSummaryByIndex = async function (socket, data) {
return 0;
}
const canRead = await privileges.posts.can('topics:read', pid, socket.uid);
if (!canRead) {
const topicPrivileges = await privileges.topics.get(data.tid, socket.uid);
if (!topicPrivileges['topics:read']) {
throw new Error('[[error:no-privileges]]');
}
const postsData = await posts.getPostSummaryByPids([pid], socket.uid, { stripTags: false });
posts.modifyPostByPrivilege(postsData[0], topicPrivileges);
return postsData[0];
};