fix thread fallback (#1478)

This commit is contained in:
Ajay Bura 2023-10-23 21:43:07 +11:00 committed by GitHub
parent 1ff312d236
commit c0abb0d50d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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';
@ -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;

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;