From c0abb0d50da8ae03fa184514c4dfdf4479635f99 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Mon, 23 Oct 2023 21:43:07 +1100 Subject: [PATCH] fix thread fallback (#1478) --- src/app/hooks/useRoomLatestRenderedEvent.ts | 4 ++-- src/app/organisms/room/RoomTimeline.tsx | 3 ++- src/app/utils/room.ts | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/hooks/useRoomLatestRenderedEvent.ts b/src/app/hooks/useRoomLatestRenderedEvent.ts index 428e7b52a..fd0ed9e5e 100644 --- a/src/app/hooks/useRoomLatestRenderedEvent.ts +++ b/src/app/hooks/useRoomLatestRenderedEvent.ts @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'; import { settingsAtom } from '../state/settings'; import { useSetting } from '../state/hooks/settings'; import { MessageEvent, StateEvent } from '../../types/matrix/room'; -import { isMembershipChanged } from '../utils/room'; +import { isMembershipChanged, reactionOrEditEvent } from '../utils/room'; export const useRoomLatestRenderedEvent = (room: Room) => { const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents'); @@ -19,7 +19,7 @@ export const useRoomLatestRenderedEvent = (room: Room) => { const evt = liveEvents[i]; if (!evt) continue; - if (evt.isRelation()) continue; + if (reactionOrEditEvent(evt)) continue; if (evt.getType() === StateEvent.RoomMember) { const membershipChanged = isMembershipChanged(evt); if (membershipChanged && hideMembershipEvents) continue; diff --git a/src/app/organisms/room/RoomTimeline.tsx b/src/app/organisms/room/RoomTimeline.tsx index 2cfbd6584..09f332603 100644 --- a/src/app/organisms/room/RoomTimeline.tsx +++ b/src/app/organisms/room/RoomTimeline.tsx @@ -86,6 +86,7 @@ import { getMemberDisplayName, getReactionContent, isMembershipChanged, + reactionOrEditEvent, } from '../../utils/room'; import { useSetting } from '../../state/hooks/settings'; import { settingsAtom } from '../../state/settings'; @@ -1632,7 +1633,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli prevEvent.getType() === mEvent.getType() && minuteDifference(prevEvent.getTs(), mEvent.getTs()) < 2; - const eventJSX = mEvent.isRelation() + const eventJSX = reactionOrEditEvent(mEvent) ? null : renderMatrixEvent(mEventId, mEvent, item, timelineSet, collapsed); prevEvent = mEvent; diff --git a/src/app/utils/room.ts b/src/app/utils/room.ts index 1c015a1ff..adb6dc088 100644 --- a/src/app/utils/room.ts +++ b/src/app/utils/room.ts @@ -380,3 +380,7 @@ export const getLatestEditableEvt = ( } return undefined; }; + +export const reactionOrEditEvent = (mEvent: MatrixEvent) => + mEvent.getRelation()?.rel_type === RelationType.Annotation || + mEvent.getRelation()?.rel_type === RelationType.Replace;