From 606d40c9d41bca829379c61fb7efc46b331b1e97 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 31 May 2021 13:55:08 +0200 Subject: [PATCH] simplify canRedact logic in view by overriding in RedactedTile --- src/domain/session/room/timeline/tiles/RedactedTile.js | 4 ++++ src/platform/web/ui/session/room/timeline/BaseMessageView.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/domain/session/room/timeline/tiles/RedactedTile.js b/src/domain/session/room/timeline/tiles/RedactedTile.js index 2363f91c..5b05effa 100644 --- a/src/domain/session/room/timeline/tiles/RedactedTile.js +++ b/src/domain/session/room/timeline/tiles/RedactedTile.js @@ -38,6 +38,10 @@ export class RedactedTile extends BaseMessageTile { return this._entry.isRedacting; } + get canRedact() { + return false; + } + abortPendingRedaction() { return this._entry.abortPendingRedaction(); } diff --git a/src/platform/web/ui/session/room/timeline/BaseMessageView.js b/src/platform/web/ui/session/room/timeline/BaseMessageView.js index c9857638..5557185e 100644 --- a/src/platform/web/ui/session/room/timeline/BaseMessageView.js +++ b/src/platform/web/ui/session/room/timeline/BaseMessageView.js @@ -94,7 +94,7 @@ export class BaseMessageView extends TemplateView { const options = []; if (vm.isPending) { options.push(Menu.option(vm.i18n`Cancel`, () => vm.abortSending())); - } else if (vm.shape !== "redacted" && vm.canRedact) { + } else if (vm.canRedact) { options.push(Menu.option(vm.i18n`Delete`, () => vm.redact()).setDestructive()); } return options;