fix thread fallback

This commit is contained in:
Ajay Bura 2023-10-23 08:58:10 +05:30
parent b80f801d23
commit 9a5c42da7c
3 changed files with 8 additions and 3 deletions

View file

@ -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;

View file

@ -86,6 +86,7 @@ import {
getMemberDisplayName,
getReactionContent,
isMembershipChanged,
reactionOrEditEvent,
} from '../../utils/room';
import { useSetting } from '../../state/hooks/settings';
import { settingsAtom } from '../../state/settings';
@ -1630,7 +1631,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;

View file

@ -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;