element-hq / element-hq/element-web

DMs don't respect room members who left when picking a name

Open
#31,022 2 comments 0 reactions 0 assignees View on GitHub
A-DM-Start A-Room O-Occasional S-Minor T-Defect
Dominant language
TypeScript
Stars
13.5k
Forks
2.8k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

You need three accounts to recreate this that (maybe?) follow a certain lexical ordering.
The issue I'm describing happens when a user migrates their account using the steps I will describe below.

Let's call the accounts `@alice:foo.com` (display name *Alice*) and `@bob:bar.com` (display name *Bob*) with Bob migrating his account over to `@charlie:baz.com` (display name *Charlie*).

1. Alice and Bob create a DM
2. Bob migrates his account to a new server and renames it in the process
2.1. The new account Charlie is created on the new home server
2.2. `@bob:bar.com` issues `/converttoroom` in his DM with `@alice.foo.com`
2.3. `@bob:bar.com` invites `@charlie.baz.com` into this room
2.4. `@charlie:baz.com` accepts the invite, joins the room and is promoted to admin
2.5. `@bob:bar.com` leaves the room
2.6. `@charlie.baz.com` issues `/converttodm` to convert the room back into a DM

### Outcome

#### What did you expect?

Alices client should interpret the room state correctly to figure out that this is now a DM with Charlie.

#### What happened instead?

On Alices side, the migrated DM **sometimes** does not rename itself to *Charlie* but stays on the old *Bob* display name.

The screenshot below shows the `m.room.member` room state from the perspective of the client that displays the wrong name (i.e. Alice).
The first member is `@alice:foo.com`, the second member is `@bob:bar.com` and the third one is `@charlie:baz.com`.
The value for `@bob:bar.com` in `content.membership` is `leave`.

Image

#### Possible Explanation

I guess (without knowing your code) that element takes the first room member that is not the local user and derives the DM name from that members display name.
This makes sense in most cases since DMs usually only contain two people.

I nonetheless ask you for the hopefully small change of filtering out not only the current local user but also users that are no longer members of the room.

### Operating system

Linux and Element Web

### Application version

Element version: 1.11.112 Crypto version: Rust SDK 0.13.0 (f64839e), Vodozemac 0.9.0

### How did you install the app?

Element web from the official element container as well as NixOS package

### Homeserver

Synapse v1.139.2

### Will you send logs?

Yes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.