fix: topic events if there is a blocked user in topic

isekai-main
Barış Soner Uşaklı 3 years ago
parent 2808c952c5
commit 3935a86b83

@ -55,8 +55,18 @@ module.exports = function (Topics) {
}
Topics.calculatePostIndices(replies, repliesStart);
postData = await user.blocks.filter(uid, postData);
await addEventStartEnd(postData, set, reverse, topicData);
const allPosts = postData.slice();
postData = await user.blocks.filter(uid, postData);
if (allPosts.length !== postData.length) {
const includedPids = new Set(postData.map(p => p.pid));
allPosts.reverse().forEach((p, index) => {
if (!includedPids.has(p.pid) && allPosts[index + 1] && !reverse) {
allPosts[index + 1].eventEnd = p.eventEnd;
}
});
}
const result = await plugins.hooks.fire('filter:topic.getPosts', {
topic: topicData,
uid: uid,

Loading…
Cancel
Save