Skip to content

fix: filter functional members from DM room display name heroes#2276

Open
beezly wants to merge 2 commits into
famedly:mainfrom
beezly:fix/dm-hero-filtering
Open

fix: filter functional members from DM room display name heroes#2276
beezly wants to merge 2 commits into
famedly:mainfrom
beezly:fix/dm-hero-filtering

Conversation

@beezly
Copy link
Copy Markdown

@beezly beezly commented Feb 26, 2026

Problem

When a room is marked as a direct message (via m.direct account data) and contains bridge bots or service members listed in the io.element.functional_members state 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.functionalMembers getter — reads the service_members list from the io.element.functional_members state event
  • getLocalizedDisplayname() — excludes functional members from the heroes list when directChatMatrixID is set
  • loadHeroUsers() — applies the same filter for consistency

References


Signed-off-by: Andrew Beresford beezly@beez.ly

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 26, 2026

CLA assistant check
All committers have signed the CLA.

@beezly
Copy link
Copy Markdown
Author

beezly commented Feb 26, 2026

Closing — not ready for review yet.

@beezly beezly closed this Feb 26, 2026
@beezly beezly reopened this Mar 15, 2026
@beezly beezly force-pushed the fix/dm-hero-filtering branch from 067003c to 45997ba Compare March 15, 2026 13:21
beezly added 2 commits March 17, 2026 10:31
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
@beezly beezly force-pushed the fix/dm-hero-filtering branch from 45997ba to a5093c7 Compare March 17, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants