diff --git a/src/topics/posts.js b/src/topics/posts.js index 5c9e52cdc6..a8a10ff60d 100644 --- a/src/topics/posts.js +++ b/src/topics/posts.js @@ -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,