From 15a7890100122df0feee6cc69e576dc2c950c6c4 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski Date: Thu, 13 Oct 2022 01:24:27 +0200 Subject: [PATCH] Determine if event belongs to thread on jumping to event This allows us to jump to any event in any thread, even if neither the thread nor the event are part of any timeline yet --- src/utils/EventUtils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/EventUtils.ts b/src/utils/EventUtils.ts index d8cf66e55736..69e322ac6dcc 100644 --- a/src/utils/EventUtils.ts +++ b/src/utils/EventUtils.ts @@ -238,8 +238,11 @@ export async function fetchInitialEvent( ) { const threadId = initialEvent.threadRootId; const room = client.getRoom(roomId); + const mapper = client.getEventMapper(); + const rootEvent = room.findEventById(threadId) + ?? mapper(await client.fetchRoomEvent(roomId, threadId)); try { - room.createThread(threadId, room.findEventById(threadId), [initialEvent], true); + room.createThread(threadId, rootEvent, [initialEvent], true); } catch (e) { logger.warn("Could not find root event: " + threadId); }