mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	fix: topic events if there is a blocked user in topic
This commit is contained in:
		| @@ -55,8 +55,18 @@ module.exports = function (Topics) { | |||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		Topics.calculatePostIndices(replies, repliesStart); | 		Topics.calculatePostIndices(replies, repliesStart); | ||||||
| 		postData = await user.blocks.filter(uid, postData); |  | ||||||
| 		await addEventStartEnd(postData, set, reverse, topicData); | 		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', { | 		const result = await plugins.hooks.fire('filter:topic.getPosts', { | ||||||
| 			topic: topicData, | 			topic: topicData, | ||||||
| 			uid: uid, | 			uid: uid, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user