Skip to content

Commit

Permalink
fix thread fallback (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura authored Oct 23, 2023
1 parent 1ff312d commit c0abb0d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/hooks/useRoomLatestRenderedEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/app/organisms/room/RoomTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ import {
getMemberDisplayName,
getReactionContent,
isMembershipChanged,
reactionOrEditEvent,
} from '../../utils/room';
import { useSetting } from '../../state/hooks/settings';
import { settingsAtom } from '../../state/settings';
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/app/utils/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit c0abb0d

Please sign in to comment.