Skip to content

Conversation

twassman
Copy link

Fixes #30883

Checklist

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the Z-Community-PR Issue is solved by a community member's PR label Sep 26, 2025
Copy link
Author

@twassman twassman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suboptimal — should probably actually recalculate the m.mentions based on message body (without reply relation), but not entirely clear to me what 'correct' design would be

@twassman twassman marked this pull request as ready for review October 8, 2025 19:38
@twassman twassman requested a review from a team as a code owner October 8, 2025 19:39
@twassman twassman requested review from dbkr and t3chguy October 8, 2025 19:39
Copy link
Author

@twassman twassman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs forwarded messages through attachMentions() — which just effectively sets m.mentions to empty, as there is no EditorModel for the forwarded message. This feels like the least-bad way to fix #30883 in alignment with the existing codebase, while leaving room for future improvements. Actually determining the m.mentions based on the message body would likely require some degree of structural changes.

Copy link
Member

@dbkr dbkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're working on tests - thanks. This could probably do with a test itself.

};

const transformEvent = (event: MatrixEvent): { type: string; content: IContent } => {
const transformEvent = (event: MatrixEvent, userId: string): { type: string; content: IContent } => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function was just about squeaking by without doc as an internal function, although it still wasn't super clear in what way it's transforming it. Now it has another param, I think it really does need doc as I have absolutely no guesses as to what this function might do with the user ID it's been given.

};
}

// Force an empty m.mentions property as there is no EditorModel to parse pills from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are explicitly forwarding an event here, I'd make this comment closer to what you have in the PR description, ie. talking about the fact we're stripping mentions from a forwarded message and why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Defect Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Forwarded messages retain original message's mentions

3 participants