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;
}
get canRedact() {
return false;
}
abortPendingRedaction() {
return this._entry.abortPendingRedaction();
}

View File

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