Fix room list often showing the wrong icons for calls (#32881)

* Give rooms with calls a proper accessible description

Besides improving accessibility, this makes it possible to check for the presence of a call indicator in the room list in Playwright tests.

* Make room list react to calls in a room, even when not connected to them

To use the results of CallStore.getRoom reactively, you need to listen for Call events, not ConnectedCalls events.

* Don't assume that every call starts off as a video call

If a Call object is created by way of someone starting a voice call, then of course the call's initial type needs to be 'voice'.

* Make room list items react to changes in call type

The type of a call may change over time; therefore room list items explicitly need to react to the changes.

* Update a call's type before notifying listeners of the change

If we notify listeners of a change in a call's type before actually making that change, the listeners will be working with glitched state. This would cause the room list to show the wrong call type in certain situations.

* Ignore the Vitest attachments directory
This commit is contained in:
Robin
2026-03-26 10:28:48 +00:00
committed by GitHub
parent 441b292353
commit 5a074e637a
15 changed files with 468 additions and 44 deletions
@@ -87,7 +87,7 @@ export class RoomListItemViewModel
});
// Subscribe to call state changes
this.disposables.trackListener(CallStore.instance, CallStoreEvent.ConnectedCalls, this.onCallStateChanged);
this.disposables.trackListener(CallStore.instance, CallStoreEvent.Call, this.onCallStateChanged);
// If there is an active call for this room, listen to participant changes
this.listenToCallParticipants();
@@ -102,6 +102,7 @@ export class RoomListItemViewModel
public dispose(): void {
super.dispose();
this.currentCall?.off(CallEvent.Participants, this.onCallParticipantsChanged);
this.currentCall?.off(CallEvent.CallTypeChanged, this.onCallTypeChanged);
}
private onNotificationChanged = (): void => {
@@ -128,16 +129,25 @@ export class RoomListItemViewModel
this.updateItem();
};
/**
* Handler for call type changes. Only updates the item if the call type is actually present in the snapshot.
*/
private onCallTypeChanged = (): void => {
if (this.snapshot.current.notification.callType !== undefined) this.updateItem();
};
/**
* Listen to participant changes for the current call in this room (if any) to trigger updates when participants join/leave the call.
*/
private listenToCallParticipants(): void {
const call = CallStore.instance.getCall(this.props.room.roomId);
// Remove listener from previous call (if any) and add to new call to track participant changes
// Remove listeners from previous call (if any) and add to new call to track changes
if (call !== this.currentCall) {
this.currentCall?.off(CallEvent.Participants, this.onCallParticipantsChanged);
this.currentCall?.off(CallEvent.CallTypeChanged, this.onCallTypeChanged);
call?.on(CallEvent.Participants, this.onCallParticipantsChanged);
call?.on(CallEvent.CallTypeChanged, this.onCallTypeChanged);
}
this.currentCall = call;
}