From 7e28aa1474ffc7a074e7d6e784d1dfcb22743c66 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Sat, 20 Aug 2022 20:51:37 +0530 Subject: [PATCH] Update sidebar on room/space switch (#768) * Select last room on space/tab change (#353) * Update sidbar on room select from search (#374) * Select last room on space/tab change (#353) * Update sidbar on room select from search (#374) * Fix wrong space gets selected with some rooms * Fix auto select room in categorized space * Fix room remain selected on leave * Fix leaved room appear in category & search * Remove globally exposed vars * Hide pin spaces from home * Fix selecting dm always open dm tab * Order category by AtoZ (#769) Co-authored-by: Krishan <33421343+kfiven@users.noreply.github.com> --- .../molecules/space-options/SpaceOptions.jsx | 4 +- src/app/organisms/join-alias/JoinAlias.jsx | 4 +- .../organisms/navigation/DrawerBreadcrumb.jsx | 7 +- src/app/organisms/navigation/Home.jsx | 6 +- src/client/event/roomList.js | 13 + src/client/initMatrix.js | 7 + src/client/state/RoomList.js | 2 +- src/client/state/navigation.js | 260 +++++++++++++++--- 8 files changed, 261 insertions(+), 42 deletions(-) diff --git a/src/app/molecules/space-options/SpaceOptions.jsx b/src/app/molecules/space-options/SpaceOptions.jsx index 56fdfd3..0c166c6 100644 --- a/src/app/molecules/space-options/SpaceOptions.jsx +++ b/src/app/molecules/space-options/SpaceOptions.jsx @@ -38,10 +38,10 @@ function SpaceOptions({ roomId, afterOptionSelect }) { const handleMarkAsRead = () => { const spaceChildren = roomList.getCategorizedSpaces([roomId]); - spaceChildren?.forEach((childIds, spaceId) => { + spaceChildren?.forEach((childIds) => { childIds?.forEach((childId) => { markAsRead(childId); - }) + }); }); afterOptionSelect(); }; diff --git a/src/app/organisms/join-alias/JoinAlias.jsx b/src/app/organisms/join-alias/JoinAlias.jsx index 9e7f6df..bb90bf3 100644 --- a/src/app/organisms/join-alias/JoinAlias.jsx +++ b/src/app/organisms/join-alias/JoinAlias.jsx @@ -6,7 +6,7 @@ import initMatrix from '../../../client/initMatrix'; import cons from '../../../client/state/cons'; import navigation from '../../../client/state/navigation'; import { join } from '../../../client/action/room'; -import { selectRoom, selectSpace } from '../../../client/action/navigation'; +import { selectRoom, selectTab } from '../../../client/action/navigation'; import Text from '../../atoms/text/Text'; import IconButton from '../../atoms/button/IconButton'; @@ -32,7 +32,7 @@ function JoinAliasContent({ term, requestClose }) { const openRoom = (roomId) => { const room = mx.getRoom(roomId); if (!room) return; - if (room.isSpaceRoom()) selectSpace(roomId); + if (room.isSpaceRoom()) selectTab(roomId); else selectRoom(roomId); requestClose(); }; diff --git a/src/app/organisms/navigation/DrawerBreadcrumb.jsx b/src/app/organisms/navigation/DrawerBreadcrumb.jsx index ca9ab6a..be5b345 100644 --- a/src/app/organisms/navigation/DrawerBreadcrumb.jsx +++ b/src/app/organisms/navigation/DrawerBreadcrumb.jsx @@ -6,7 +6,7 @@ import { twemojify } from '../../../util/twemojify'; import initMatrix from '../../../client/initMatrix'; import cons from '../../../client/state/cons'; -import { selectSpace } from '../../../client/action/navigation'; +import { selectTab, selectSpace } from '../../../client/action/navigation'; import navigation from '../../../client/state/navigation'; import { abbreviateNumber } from '../../../util/common'; @@ -107,7 +107,10 @@ function DrawerBreadcrumb({ spaceId }) { { index !== 0 && }