element-web icon indicating copy to clipboard operation
element-web copied to clipboard

Recalculate mentions of forwarded messages

Open twassman opened this issue 2 months ago • 3 comments

In transformEvent(), parse event body back into an EditorModel, and pass this into attachMentions(), so that it actually recalculates mentions based on the message body.

Follow up to #30884.

Checklist

  • [x] I have read through review guidelines and CONTRIBUTING.md.
  • [ ] Tests written for new code (and old code if feasible).
  • [x] New or updated public/exported symbols have accurate TSDoc documentation.
  • [x] Linter and other CI checks pass.
  • [x] I have licensed the changes to Element by completing the Contributor License Agreement (CLA)

twassman avatar Nov 07 '25 02:11 twassman

Tests are pending me figuring out how to correctly mock room membership. In the not-unlikely event that someone knows how to do this, assistance would be welcome.

twassman avatar Nov 07 '25 05:11 twassman

Tests are pending me figuring out how to correctly mock room membership. In the not-unlikely event that someone knows how to do this, assistance would be welcome.

Hi sorry for the delay!

You can use https://github.com/element-hq/element-web/blob/e97de7d2ea1172e9c11ed604afdf3864bc2fb519/test/test-utils/test-utils.ts#L473 to create a room membership event.

Or you can also mock the membership of the room with: jest.spyOn(room, "getMyMembership").mockReturnValue(KnownMembership.Join);

florianduros avatar Dec 08 '25 15:12 florianduros

Thank you! I'll take a look and see if I can implement this.

twassman avatar Dec 11 '25 21:12 twassman

Apparently all that was necessary was to mock the source room. This should be sufficient?

twassman avatar Dec 15 '25 02:12 twassman

@twassman can you update the PR title to something helpful in a changelog, Recalculate mentions of forwarded messages means nothing to a user

t3chguy avatar Dec 15 '25 10:12 t3chguy

@t3chguy: Better?

twassman avatar Dec 15 '25 17:12 twassman

Not really? What user impact does this have?

t3chguy avatar Dec 15 '25 17:12 t3chguy

Ostensibly that the correct set of users would get mentioned when receiving such forwarded messages. I'm not sure exactly what would be preferable for title phrasing.

twassman avatar Dec 15 '25 17:12 twassman