Fix space panel notification badge behaviour and metrics (#7823)

This commit is contained in:
Michael Telatynski 2022-02-17 09:20:48 +00:00 committed by GitHub
parent cd49852c2d
commit 2f1d2ed5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,15 +154,14 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
public setActiveRoomInSpace(space: SpaceKey): void { public setActiveRoomInSpace(space: SpaceKey): void {
if (!isMetaSpace(space) && !this.matrixClient?.getRoom(space)?.isSpaceRoom()) return; if (!isMetaSpace(space) && !this.matrixClient?.getRoom(space)?.isSpaceRoom()) return;
if (space !== this.activeSpace) this.setActiveSpace(space); if (space !== this.activeSpace) this.setActiveSpace(space, false);
if (space) { if (space) {
const roomId = this.getNotificationState(space).getFirstRoomWithNotifications(); const roomId = this.getNotificationState(space).getFirstRoomWithNotifications();
defaultDispatcher.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: roomId, room_id: roomId,
context_switch: true, _trigger: "WebSpacePanelNotificationBadge",
_trigger: "WebSpaceContextSwitch",
}); });
} else { } else {
const lists = RoomListStore.instance.unfilteredLists; const lists = RoomListStore.instance.unfilteredLists;
@ -179,8 +178,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
defaultDispatcher.dispatch<ViewRoomPayload>({ defaultDispatcher.dispatch<ViewRoomPayload>({
action: Action.ViewRoom, action: Action.ViewRoom,
room_id: unreadRoom.roomId, room_id: unreadRoom.roomId,
context_switch: true, _trigger: "WebSpacePanelNotificationBadge",
_trigger: "WebSpaceContextSwitch",
}); });
break; break;
} }