mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	fix: limited visibility remote posts with greater scope than asserted roomId should add those users to the chat room, #12834
This commit is contained in:
		| @@ -225,9 +225,11 @@ Notes.assertPrivate = async (object) => { | ||||
| 	} | ||||
|  | ||||
| 	// Compare room members with object recipients; if someone in-room is omitted, start new chat | ||||
| 	const participants = await messaging.getUsersInRoom(roomId, 0, -1); | ||||
| 	const participantUids = participants.map(user => user.uid); | ||||
| 	if (roomId) { | ||||
| 		const participants = await messaging.getUsersInRoom(roomId, 0, -1); | ||||
| 		const omitted = participants.filter((user) => { | ||||
| 			// todo: this could use recipientsResolved | ||||
| 			let { uid } = user; | ||||
| 			uid = utils.isNumber(uid) ? `${nconf.get('url')}/uid/${uid}` : uid; | ||||
| 			return !recipients.has(uid) && uid !== object.attributedTo; | ||||
| @@ -250,6 +252,13 @@ Notes.assertPrivate = async (object) => { | ||||
| 		timestamp = Date.now(); // otherwise message can't be seen in room as it pre-dates participants joining | ||||
| 	} | ||||
|  | ||||
| 	// Add any new members to the chat | ||||
| 	const added = Array.from(recipientsResolved).filter(uid => !participantUids.includes(uid)); | ||||
| 	const assertion = await activitypub.actors.assert(added); | ||||
| 	if (assertion) { | ||||
| 		await messaging.addUsersToRoom(object.attributedTo, added, roomId); | ||||
| 	} | ||||
|  | ||||
| 	// Add message to room | ||||
| 	await messaging.sendMessage({ | ||||
| 		mid: object.id, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user