Show text and video rooms in different categories

This commit is contained in:
IceDBorn 2023-03-26 01:00:20 +02:00
parent 59375f02b8
commit 3285c4ce22

View file

@ -23,11 +23,24 @@ function Home({ spaceId, jitsiCallId }) {
let spaceIds = []; let spaceIds = [];
let roomIds = []; let roomIds = [];
let directIds = []; let directIds = [];
let videoRoomIds = [];
if (spaceId) { if (spaceId) {
const spaceChildIds = roomList.getSpaceChildren(spaceId) ?? []; const spaceChildIds = roomList.getSpaceChildren(spaceId) ?? [];
const TOPIC_JITSI_CALL = 'd38dd491fefa1cfffc27f9c57f2bdb4a';
spaceIds = spaceChildIds.filter((roomId) => spaces.has(roomId)); spaceIds = spaceChildIds.filter((roomId) => spaces.has(roomId));
roomIds = spaceChildIds.filter((roomId) => rooms.has(roomId)); roomIds = spaceChildIds.filter(
(roomId) =>
rooms.has(roomId) &&
mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic !==
TOPIC_JITSI_CALL
);
videoRoomIds = spaceChildIds.filter(
(roomId) =>
rooms.has(roomId) &&
mx.getRoom(roomId).currentState.getStateEvents('m.room.topic')[0]?.getContent().topic ===
TOPIC_JITSI_CALL
);
directIds = spaceChildIds.filter((roomId) => directs.has(roomId)); directIds = spaceChildIds.filter((roomId) => directs.has(roomId));
} else { } else {
spaceIds = roomList.getOrphanSpaces().filter((id) => !accountData.spaceShortcut.has(id)); spaceIds = roomList.getOrphanSpaces().filter((id) => !accountData.spaceShortcut.has(id));
@ -78,9 +91,17 @@ function Home({ spaceId, jitsiCallId }) {
{roomIds.length !== 0 && ( {roomIds.length !== 0 && (
<RoomsCategory <RoomsCategory
name="Rooms" name="Text Rooms"
roomIds={roomIds.sort(roomIdByAtoZ)} roomIds={roomIds.sort(roomIdByAtoZ)}
drawerPostie={drawerPostie} drawerPostie={drawerPostie}
/>
)}
{videoRoomIds.length !== 0 && (
<RoomsCategory
name="Video Rooms"
roomIds={videoRoomIds}
drawerPostie={drawerPostie}
jitsiCallId={jitsiCallId} jitsiCallId={jitsiCallId}
/> />
)} )}