Navigate to room with maximum notifications when clicked on already selected space
This commit is contained in:
parent
2bf931b9d3
commit
73b9ad41da
2 changed files with 18 additions and 2 deletions
|
@ -120,8 +120,19 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
* should not be done when the space switch is done implicitly due to another event like switching room.
|
||||
*/
|
||||
public async setActiveSpace(space: Room | null, contextSwitch = true) {
|
||||
if (space === this.activeSpace || (space && !space?.isSpaceRoom())) return;
|
||||
|
||||
if (space && !space?.isSpaceRoom()) return;
|
||||
if (space === this.activeSpace) {
|
||||
const notificationState = this.getNotificationState(space.roomId);
|
||||
if (notificationState.count) {
|
||||
const roomId = notificationState.getRoomWithMaxNotifications();
|
||||
defaultDispatcher.dispatch({
|
||||
action: "view_room",
|
||||
room_id: roomId,
|
||||
context_switch: true,
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
this._activeSpace = space;
|
||||
this.emit(UPDATE_SELECTED_SPACE, this.activeSpace);
|
||||
this.emit(SUGGESTED_ROOMS, this._suggestedRooms = []);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue