Implement MSC4142: Remove unintentional intentional mentions in replies (#28209)

* Implement MSC4142: Remove unintentional intentional mentions in replies

* Fix comment
This commit is contained in:
Tulir Asokan
2025-03-13 18:00:54 +02:00
committed by GitHub
parent 9bfea92b66
commit fda658182a
3 changed files with 3 additions and 12 deletions

View File

@@ -95,16 +95,9 @@ export function attachMentions(
const userMentions = new Set<string>();
let roomMention = false;
// If there's a reply, initialize the mentioned users as the sender of that
// event + any mentioned users in that event.
// If there's a reply, initialize the mentioned users as the sender of that event.
if (replyToEvent) {
userMentions.add(replyToEvent.sender!.userId);
// TODO What do we do if the reply event *doeesn't* have this property?
// Try to fish out replies from the contents?
const userIds = replyToEvent.getContent()["m.mentions"]?.user_ids;
if (Array.isArray(userIds)) {
userIds.forEach((userId) => userMentions.add(userId));
}
}
// If user provided content is available, check to see if any users are mentioned.