From 879832a4eb0bfaaa3c44f2e6293d6cd4a9260877 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 29 Jun 2023 09:19:18 +0100 Subject: [PATCH] Fix spurious error sending receipt in thread errors (#11157) Trying to send an RR to the first event fails in threads as that event is a thread root and cannot carry a threaded RR so instead target the last event --- src/components/structures/TimelinePanel.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/TimelinePanel.tsx b/src/components/structures/TimelinePanel.tsx index d9dfa64493..061aa9d10e 100644 --- a/src/components/structures/TimelinePanel.tsx +++ b/src/components/structures/TimelinePanel.tsx @@ -1135,7 +1135,7 @@ class TimelinePanel extends React.Component { const lastReadEventIndex = this.getLastDisplayedEventIndex({ ignoreOwn: true, }); - const lastReadEvent: MatrixEvent | null = this.state.events[lastReadEventIndex ?? 0] ?? null; + const lastReadEvent = this.state.events[lastReadEventIndex ?? this.state.events.length - 1] ?? null; const shouldSendReadReceipt = this.shouldSendReadReceipt( currentReadReceiptEventId,