Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit ba3d2de

Browse files
committed
Stop tracking threads if threads support is disabled
1 parent fe4683d commit ba3d2de

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/components/structures/RoomView.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,15 +1395,17 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
13951395
return b.length - a.length;
13961396
});
13971397

1398-
// Process all thread roots returned in this batch of search results
1399-
// XXX: This won't work for results coming from Seshat which won't include the bundled relationship
1400-
for (const result of results.results) {
1401-
for (const event of result.context.getTimeline()) {
1402-
const bundledRelationship = event
1403-
.getServerAggregatedRelation<IThreadBundledRelationship>(THREAD_RELATION_TYPE.name);
1404-
if (!bundledRelationship || event.getThread()) continue;
1405-
const room = this.context.getRoom(event.getRoomId());
1406-
event.setThread(room.findThreadForEvent(event) ?? room.createThread(event, [], true));
1398+
if (this.context.supportsExperimentalThreads()) {
1399+
// Process all thread roots returned in this batch of search results
1400+
// XXX: This won't work for results coming from Seshat which won't include the bundled relationship
1401+
for (const result of results.results) {
1402+
for (const event of result.context.getTimeline()) {
1403+
const bundledRelationship = event
1404+
.getServerAggregatedRelation<IThreadBundledRelationship>(THREAD_RELATION_TYPE.name);
1405+
if (!bundledRelationship || event.getThread()) continue;
1406+
const room = this.context.getRoom(event.getRoomId());
1407+
event.setThread(room.findThreadForEvent(event) ?? room.createThread(event, [], true));
1408+
}
14071409
}
14081410
}
14091411

src/utils/EventUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export async function fetchInitialEvent(
217217
initialEvent = null;
218218
}
219219

220-
if (initialEvent?.isThreadRelation) {
220+
if (initialEvent?.isThreadRelation && client.supportsExperimentalThreads()) {
221221
try {
222222
const rootEventData = await client.fetchRoomEvent(roomId, initialEvent.threadRootId);
223223
const rootEvent = new MatrixEvent(rootEventData);

0 commit comments

Comments
 (0)