mirror of
https://github.com/cinnyapp/cinny.git
synced 2024-11-20 06:49:52 +01:00
fix thread fallback
This commit is contained in:
parent
b80f801d23
commit
9a5c42da7c
3 changed files with 8 additions and 3 deletions
|
@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
|
||||||
import { settingsAtom } from '../state/settings';
|
import { settingsAtom } from '../state/settings';
|
||||||
import { useSetting } from '../state/hooks/settings';
|
import { useSetting } from '../state/hooks/settings';
|
||||||
import { MessageEvent, StateEvent } from '../../types/matrix/room';
|
import { MessageEvent, StateEvent } from '../../types/matrix/room';
|
||||||
import { isMembershipChanged } from '../utils/room';
|
import { isMembershipChanged, reactionOrEditEvent } from '../utils/room';
|
||||||
|
|
||||||
export const useRoomLatestRenderedEvent = (room: Room) => {
|
export const useRoomLatestRenderedEvent = (room: Room) => {
|
||||||
const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents');
|
const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents');
|
||||||
|
@ -19,7 +19,7 @@ export const useRoomLatestRenderedEvent = (room: Room) => {
|
||||||
const evt = liveEvents[i];
|
const evt = liveEvents[i];
|
||||||
|
|
||||||
if (!evt) continue;
|
if (!evt) continue;
|
||||||
if (evt.isRelation()) continue;
|
if (reactionOrEditEvent(evt)) continue;
|
||||||
if (evt.getType() === StateEvent.RoomMember) {
|
if (evt.getType() === StateEvent.RoomMember) {
|
||||||
const membershipChanged = isMembershipChanged(evt);
|
const membershipChanged = isMembershipChanged(evt);
|
||||||
if (membershipChanged && hideMembershipEvents) continue;
|
if (membershipChanged && hideMembershipEvents) continue;
|
||||||
|
|
|
@ -86,6 +86,7 @@ import {
|
||||||
getMemberDisplayName,
|
getMemberDisplayName,
|
||||||
getReactionContent,
|
getReactionContent,
|
||||||
isMembershipChanged,
|
isMembershipChanged,
|
||||||
|
reactionOrEditEvent,
|
||||||
} from '../../utils/room';
|
} from '../../utils/room';
|
||||||
import { useSetting } from '../../state/hooks/settings';
|
import { useSetting } from '../../state/hooks/settings';
|
||||||
import { settingsAtom } from '../../state/settings';
|
import { settingsAtom } from '../../state/settings';
|
||||||
|
@ -1630,7 +1631,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||||
prevEvent.getType() === mEvent.getType() &&
|
prevEvent.getType() === mEvent.getType() &&
|
||||||
minuteDifference(prevEvent.getTs(), mEvent.getTs()) < 2;
|
minuteDifference(prevEvent.getTs(), mEvent.getTs()) < 2;
|
||||||
|
|
||||||
const eventJSX = mEvent.isRelation()
|
const eventJSX = reactionOrEditEvent(mEvent)
|
||||||
? null
|
? null
|
||||||
: renderMatrixEvent(mEventId, mEvent, item, timelineSet, collapsed);
|
: renderMatrixEvent(mEventId, mEvent, item, timelineSet, collapsed);
|
||||||
prevEvent = mEvent;
|
prevEvent = mEvent;
|
||||||
|
|
|
@ -380,3 +380,7 @@ export const getLatestEditableEvt = (
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const reactionOrEditEvent = (mEvent: MatrixEvent) =>
|
||||||
|
mEvent.getRelation()?.rel_type === RelationType.Annotation ||
|
||||||
|
mEvent.getRelation()?.rel_type === RelationType.Replace;
|
||||||
|
|
Loading…
Reference in a new issue