fix: filter functional members from DM room display name heroes#2276
Open
beezly wants to merge 2 commits into
Open
fix: filter functional members from DM room display name heroes#2276beezly wants to merge 2 commits into
beezly wants to merge 2 commits into
Conversation
Author
|
Closing — not ready for review yet. |
067003c to
45997ba
Compare
When a room is marked as a DM (via m.direct account data) and contains bridge bots or service members listed in the io.element.functional_members state event, those users were incorrectly included in the room display name and hero list. This mirrors the JS SDK's getFunctionalMembers() approach: read the service_members list from the io.element.functional_members state event and exclude those user IDs from heroes when computing the room name for a DM room. Adds: - Room.functionalMembers getter to read io.element.functional_members - Filtering in getLocalizedDisplayname() to exclude functional members from heroes when directChatMatrixID is set - Filtering in loadHeroUsers() for the same reason Fixes: krille-chan/fluffychat#2116 See: https://github.com/element-hq/element-meta/blob/develop/spec/functional_members.md
45997ba to
a5093c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a room is marked as a direct message (via
m.directaccount data) and contains bridge bots or service members listed in theio.element.functional_membersstate event, those bots were incorrectly included in the room hero list and therefore appeared in the room display name.For example, if a WhatsApp bridge bot (
@whatsappbot:server) is a member of a DM room alongside the real contact, the room would be named something like "Alice and @whatsappbot:server" instead of just "Alice".Solution
This PR adds filtering of functional members from the hero list when computing the display name and loading hero users for DM rooms. It mirrors the approach used in the matrix-js-sdk's
getFunctionalMembers().Changes
Room.functionalMembersgetter — reads theservice_memberslist from theio.element.functional_membersstate eventgetLocalizedDisplayname()— excludes functional members from the heroes list whendirectChatMatrixIDis setloadHeroUsers()— applies the same filter for consistencyReferences
Signed-off-by: Andrew Beresford beezly@beez.ly