Recalculate mentions of forwarded messages
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/exportedsymbols 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)
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.
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);
Thank you! I'll take a look and see if I can implement this.
Apparently all that was necessary was to mock the source room. This should be sufficient?
@twassman can you update the PR title to something helpful in a changelog, Recalculate mentions of forwarded messages means nothing to a user
@t3chguy: Better?
Not really? What user impact does this have?
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.