Fix regression of edits showing up in the timeline with hidden events shown (#8260)

This commit is contained in:
Michael Telatynski 2022-04-08 12:10:10 +01:00 committed by GitHub
parent f63923d60f
commit 0aa8b93c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -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();
}

View File

@ -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);