cetirizine

An experimental matrix client written in reactjs utilizing tailwind and storybook
git clone git://archive.git.mtrnord.blog/MTRNord/cetirizine.git
Log | Files | Refs | README | LICENSE

commit 48cc1217ab36fcf620b46ea30405f39ac8c58b3d
parent f08c46cfb3d80f354c096fb5fb5a5ff7e7395c69
Author: MTRNord <mtrnord1@gmail.com>
Date:   Mon,  8 May 2023 01:48:25 +0200

Properly fix choosing previousEvent

Diffstat:
Msrc/pages/MainPage.tsx | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/pages/MainPage.tsx b/src/pages/MainPage.tsx @@ -44,11 +44,12 @@ const ChatView: FC<ChatViewProps> = memo(({ roomID, scrollRef }) => { return self.findIndex(e => e.event_id === event.event_id) === index; }).sort((a, b) => { return a.origin_server_ts - b.origin_server_ts; - }).filter(event => event.type !== "m.reaction" && event.type !== "m.room.redaction" && !event.content["m.relates_to"]); + }) + const no_relations = dedupedEvents.filter(event => event.type !== "m.reaction" && event.type !== "m.room.redaction" && !event.content["m.relates_to"]); - Promise.all(dedupedEvents?.map(async (event, index) => { - let previousEvent = dedupedEvents?.[index - 1]; + Promise.all(no_relations?.map(async (event, index) => { + let previousEvent = no_relations?.[index - 1]; const previousEventIsFromSameSender = previousEvent?.sender === event.sender; let previousEventType = previousEvent?.type; @@ -58,7 +59,7 @@ const ChatView: FC<ChatViewProps> = memo(({ roomID, scrollRef }) => { }); // Check if event is redacted - const redaction = dedupedEvents?.find((e) => { + const redaction = no_relations?.find((e) => { return e.type === "m.room.redaction" && e.redacts === event.event_id; }); const redacted = redaction !== undefined;