From cb622be653f650ad0d98a4476053aa32c78bfc41 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 25 May 2021 12:58:20 +0200 Subject: [PATCH] rerender tile when becoming or stopped being redacted --- src/domain/session/room/timeline/tiles/RedactedTile.js | 2 +- src/domain/session/room/timeline/tiles/SimpleTile.js | 9 +++++---- src/platform/web/ui/session/room/TimelineList.js | 1 + src/platform/web/ui/session/room/timeline/common.js | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/domain/session/room/timeline/tiles/RedactedTile.js b/src/domain/session/room/timeline/tiles/RedactedTile.js index bf1fc0db..81b286a5 100644 --- a/src/domain/session/room/timeline/tiles/RedactedTile.js +++ b/src/domain/session/room/timeline/tiles/RedactedTile.js @@ -18,7 +18,7 @@ import {BaseTextTile} from "./BaseTextTile.js"; export class RedactedTile extends BaseTextTile { get shape() { - return "message-status" + return "redacted"; } _getBodyAsString() { diff --git a/src/domain/session/room/timeline/tiles/SimpleTile.js b/src/domain/session/room/timeline/tiles/SimpleTile.js index c4935f1d..29f9980b 100644 --- a/src/domain/session/room/timeline/tiles/SimpleTile.js +++ b/src/domain/session/room/timeline/tiles/SimpleTile.js @@ -83,13 +83,14 @@ export class SimpleTile extends ViewModel { } // update received for already included (falls within sort keys) entry - updateEntry(entry, params) { - if (entry.isRedacted) { + updateEntry(entry, param) { + const renderedAsRedacted = this.shape === "redacted"; + if (entry.isRedacted !== renderedAsRedacted) { // recreate the tile if the entry becomes redacted - return UpdateAction.Replace(params); + return UpdateAction.Replace("shape"); } else { this._entry = entry; - return UpdateAction.Update(params); + return UpdateAction.Update(param); } } diff --git a/src/platform/web/ui/session/room/TimelineList.js b/src/platform/web/ui/session/room/TimelineList.js index 791e23a3..b55c2450 100644 --- a/src/platform/web/ui/session/room/TimelineList.js +++ b/src/platform/web/ui/session/room/TimelineList.js @@ -29,6 +29,7 @@ function viewClassForEntry(entry) { case "announcement": return AnnouncementView; case "message": case "message-status": + case "redacted": return TextMessageView; case "image": return ImageView; case "video": return VideoView; diff --git a/src/platform/web/ui/session/room/timeline/common.js b/src/platform/web/ui/session/room/timeline/common.js index 22bcd6b1..3b53245e 100644 --- a/src/platform/web/ui/session/room/timeline/common.js +++ b/src/platform/web/ui/session/room/timeline/common.js @@ -24,7 +24,7 @@ export function renderMessage(t, vm, children) { unsent: vm.isUnsent, unverified: vm.isUnverified, continuation: vm => vm.isContinuation, - messageStatus: vm => vm.shape === "message-status" || vm.shape === "missing-attachment" || vm.shape === "file", + messageStatus: vm => vm.shape === "message-status" || vm.shape === "missing-attachment" || vm.shape === "file" || vm.shape === "redacted", }; const profile = t.div({className: "profile"}, [