fix: dont show deleted posts in navigator

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 32e36f7b2e
commit 931105e6cb

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

Loading…
Cancel
Save