From 0aa8b93c0716d45376f3b8b036ec9e405d648557 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 8 Apr 2022 12:10:10 +0100 Subject: [PATCH] Fix regression of edits showing up in the timeline with hidden events shown (#8260) --- src/events/EventTileFactory.tsx | 4 ++++ src/shouldHideEvent.ts | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/events/EventTileFactory.tsx b/src/events/EventTileFactory.tsx index dbf35d6afb..3f470a19b6 100644 --- a/src/events/EventTileFactory.tsx +++ b/src/events/EventTileFactory.tsx @@ -231,6 +231,10 @@ export function pickFactory(mxEvent: MatrixEvent, cli: MatrixClient, asHiddenEv? return MessageEventFactory; } + if (mxEvent.isRelation(RelationType.Replace)) { + return noEventFactoryFactory(); + } + return EVENT_TILE_TYPES[evType] ?? noEventFactoryFactory(); } diff --git a/src/shouldHideEvent.ts b/src/shouldHideEvent.ts index 5ca9d00e69..8fef94ac9d 100644 --- a/src/shouldHideEvent.ts +++ b/src/shouldHideEvent.ts @@ -15,6 +15,7 @@ */ import { MatrixEvent } from "matrix-js-sdk/src/models/event"; +import { EventType, RelationType } from "matrix-js-sdk/src/@types/event"; import SettingsStore from "./settings/SettingsStore"; import { IRoomState } from "./components/structures/RoomView"; @@ -29,7 +30,7 @@ interface IDiff { function memberEventDiff(ev: MatrixEvent): IDiff { const diff: IDiff = { - isMemberEvent: ev.getType() === 'm.room.member', + isMemberEvent: ev.getType() === EventType.RoomMember, }; // If is not a Member Event then the other checks do not apply, so bail early. @@ -67,7 +68,7 @@ export default function shouldHideEvent(ev: MatrixEvent, ctx?: IRoomState): bool if (ev.isRedacted() && !isEnabled('showRedactions') && !ev.getThread()) return true; // Hide replacement events since they update the original tile (if enabled) - if (ev.isRelation("m.replace")) return true; + if (ev.isRelation(RelationType.Replace)) return true; const eventDiff = memberEventDiff(ev);