only show cancel option if not already sending

This commit is contained in:
Bruno Windels 2021-06-02 11:56:15 +02:00
parent addddf1f26
commit 15f6ab8b7e
2 changed files with 8 additions and 2 deletions

View file

@ -49,7 +49,13 @@ export class SimpleTile extends ViewModel {
} }
get isUnsent() { get isUnsent() {
return this._entry.isPending && this._entry.status !== SendStatus.Sent; return this._entry.isPending && this._entry.pendingEvent.status !== SendStatus.Sent;
}
get canAbortSending() {
return this._entry.isPending &&
this._entry.pendingEvent.status !== SendStatus.Sending &&
this._entry.pendingEvent.status !== SendStatus.Sent;
} }
abortSending() { abortSending() {

View file

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