fix hide reactions

This commit is contained in:
7w1 committed 2026-06-14 11:28:51 -05:00
1 parent 6c72ab56f0
commit 33458114dc
4 files changed
+27

No files matched your search

@@ -0,0 +1,5 @@
---
default: patch
---
Hide membership events in read only rooms now also hides reactions and reaction redactions.
@@ -1021,6 +1021,7 @@ function Messages() {
<SettingTile
title="Hide Member Events in Read-Only Rooms"
focusId="hide-member-events-read-only-rooms"
description="Hide membership changes, reactions, and reaction redactions in read-only rooms such as announcement channels."
after={
<Switch
variant="Primary"
@@ -1,5 +1,6 @@
import { useMemo } from 'react';
import type { MatrixEvent, EventTimelineSet, EventTimeline } from '$types/matrix-sdk';
import { EventType } from '$types/matrix-sdk';
import {
getTimelineAndBaseIndex,
getTimelineRelativeIndex,
@@ -12,6 +13,7 @@ import {
isReactionEvent,
isRedactableMessageType,
shouldShowRedactionTimelineEvent,
getRedactionTargetEvent,
collectRelationReactionEvents,
collectRelationEditEvents,
} from '$utils/room';
@@ -150,9 +152,13 @@ const mergeRelationReactions = (
ignoredUsersSet: Set<string>,
hiddenEventReactions: boolean,
hiddenEventReactionTombstone: boolean,
hideMemberInReadOnly: boolean,
isReadOnly: boolean,
mxUserId: string | null,
readUptoEventId: string | undefined
): ProcessedEvent[] => {
if (hideMemberInReadOnly && isReadOnly) return result;
const existingIds = new Set(result.map((event) => event.id));
const extras = collectRelationReactionEvents(
linkedTimelines,
@@ -273,6 +279,16 @@ export function useProcessedTimeline({
const isReaction = isReactionEvent(mEvent);
const isRedactionEvt = mEvent.isRedaction();
if (hideMemberInReadOnly && isReadOnly) {
if (isReaction) return acc;
if (
isRedactionEvt &&
getRedactionTargetEvent(timelineSet, mEvent)?.getType() === (EventType.Reaction as string)
) {
return acc;
}
}
if (mEvent.isRedacted()) {
const showMessageTombstone = showTombstoneEvents && isRedactableMessageType(type);
const showReactionTombstone = hiddenEventReactionTombstone && isReaction;
@@ -409,6 +425,8 @@ export function useProcessedTimeline({
ignoredUsersSet,
hiddenEventReactions,
hiddenEventReactionTombstone,
hideMemberInReadOnly,
isReadOnly,
mxUserId,
readUptoEventId
),
@@ -1367,6 +1367,8 @@ export function useTimelineEventRenderer({
);
},
[EventType.Reaction]: (mEventId, mEvent, item, timelineSet, collapse) => {
if (hideMemberInReadOnly && isReadOnly) return null;
const highlighted = focusItem?.index === item && focusItem.highlight;
const marked = activeReplyId === mEventId;
const senderId = mEvent.getSender() ?? '';
@@ -1485,6 +1487,7 @@ export function useTimelineEventRenderer({
const target = getRedactionTargetEvent(timelineSet, mEvent);
const isReactionRedaction = target?.getType() === (EventType.Reaction as string);
if (isReactionRedaction) {
if (hideMemberInReadOnly && isReadOnly) return null;
if (!hiddenEventReactionRedactionTimeline) return null;
} else if (!hiddenEventRedactionTimeline) {
return null;