feat: Integrate forum layout support across various components and enhance room handling logic
This commit is contained in:
@@ -6,7 +6,7 @@ import { QueryFunction, useInfiniteQuery } from '@tanstack/react-query';
|
||||
import { useMatrixClient } from './useMatrixClient';
|
||||
import { roomToParentsAtom } from '../state/room/roomToParents';
|
||||
import { MSpaceChildContent, StateEvent } from '../../types/matrix/room';
|
||||
import { getAllParents, getStateEvents, isValidChild } from '../utils/room';
|
||||
import { getAllParents, getStateEvents, isSpace, isValidChild } from '../utils/room';
|
||||
import { isRoomId } from '../utils/matrix';
|
||||
import { SortFunc, byOrderKey, byTsOldToNew, factoryRoomIdByActivity } from '../utils/sort';
|
||||
import { useStateEventCallback } from './useStateEventCallback';
|
||||
@@ -64,7 +64,7 @@ const getHierarchySpaces = (
|
||||
// because we can not find if a childId is space without joining
|
||||
// or requesting room summary, we will look it into spaceRooms local
|
||||
// cache which we maintain as we load summary in UI.
|
||||
if (getRoom(childId)?.isSpaceRoom() || spaceRooms.has(childId)) {
|
||||
if (isSpace(getRoom(childId) ?? null) || spaceRooms.has(childId)) {
|
||||
const childItem: HierarchyItemSpace = {
|
||||
roomId: childId,
|
||||
content: childEvent.getContent<MSpaceChildContent>(),
|
||||
@@ -114,7 +114,7 @@ const getSpaceHierarchy = (
|
||||
if (!isValidChild(childEvent)) return;
|
||||
const childId = childEvent.getStateKey();
|
||||
if (!childId || !isRoomId(childId)) return;
|
||||
if (getRoom(childId)?.isSpaceRoom() || spaceRooms.has(childId)) return;
|
||||
if (isSpace(getRoom(childId) ?? null) || spaceRooms.has(childId)) return;
|
||||
|
||||
const childItem: HierarchyItemRoom = {
|
||||
roomId: childId,
|
||||
@@ -189,7 +189,7 @@ const getSpaceJoinedHierarchy = (
|
||||
const childId = childEvent.getStateKey();
|
||||
if (!childId || !isRoomId(childId)) return false;
|
||||
const room = getRoom(childId);
|
||||
if (!room || room.isSpaceRoom()) return false;
|
||||
if (!room || isSpace(room)) return false;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user