From dfdf8e72461f3bbb32819ea8c26fe841fefaf7b3 Mon Sep 17 00:00:00 2001 From: Janne Mareike Koschinski Date: Thu, 13 Oct 2022 01:24:27 +0200 Subject: [PATCH] Use fallback for thread root event if available --- 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); }