simplify canRedact logic in view by overriding in RedactedTile

This commit is contained in:
Bruno Windels 2021-05-31 13:55:08 +02:00
parent 23459aad52
commit 606d40c9d4
2 changed files with 5 additions and 1 deletions

View file

@ -38,6 +38,10 @@ export class RedactedTile extends BaseMessageTile {
return this._entry.isRedacting; return this._entry.isRedacting;
} }
get canRedact() {
return false;
}
abortPendingRedaction() { abortPendingRedaction() {
return this._entry.abortPendingRedaction(); return this._entry.abortPendingRedaction();
} }

View file

@ -94,7 +94,7 @@ export class BaseMessageView extends TemplateView {
const options = []; const options = [];
if (vm.isPending) { if (vm.isPending) {
options.push(Menu.option(vm.i18n`Cancel`, () => vm.abortSending())); 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()); options.push(Menu.option(vm.i18n`Delete`, () => vm.redact()).setDestructive());
} }
return options; return options;