From 00c2c7ffdaeb5328698fb0698d3c405396200bf2 Mon Sep 17 00:00:00 2001 From: mup Date: Mon, 19 Feb 2024 14:40:02 +0100 Subject: [PATCH] Remove selectNone from attributes and inject directly in onDelete --- src/contacts/view/ContactView.ts | 3 +-- src/contacts/view/ContactViewerActions.ts | 5 ++--- src/search/view/SearchView.ts | 6 ++---- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/contacts/view/ContactView.ts b/src/contacts/view/ContactView.ts index 1ef9bce93619..22099f1f1c90 100644 --- a/src/contacts/view/ContactView.ts +++ b/src/contacts/view/ContactView.ts @@ -279,9 +279,8 @@ export class ContactView extends BaseTopLevelView implements TopLevelView this.editContact(c), onExport: exportContacts, - onDelete: deleteContacts, + onDelete: (contacts: Contact[]) => deleteContacts(contacts, () => this.contactViewModel.listModel.selectNone()), onMerge: confirmMerge, - selectNone: () => this.contactViewModel.listModel.selectNone(), }) } } diff --git a/src/contacts/view/ContactViewerActions.ts b/src/contacts/view/ContactViewerActions.ts index 21173b683dac..d1bb6b3043f6 100644 --- a/src/contacts/view/ContactViewerActions.ts +++ b/src/contacts/view/ContactViewerActions.ts @@ -8,10 +8,9 @@ import { Keys } from "../../api/common/TutanotaConstants.js" export interface ContactViewToolbarAttrs { contacts: Contact[] onEdit: (contact: Contact) => unknown - onDelete: (contacts: Contact[], onConfirm: () => void) => unknown + onDelete: (contacts: Contact[]) => unknown onMerge: (left: Contact, right: Contact) => unknown onExport: (contacts: Contact[]) => unknown - selectNone: () => unknown } /** @@ -55,7 +54,7 @@ export class ContactViewerActions implements Component actionButtons.push( m(IconButton, { title: "delete_action", - click: () => onDelete(contacts, attrs.selectNone), + click: () => onDelete(contacts), icon: Icons.Trash, }), ) diff --git a/src/search/view/SearchView.ts b/src/search/view/SearchView.ts index d923e42480a9..e92f33c40834 100644 --- a/src/search/view/SearchView.ts +++ b/src/search/view/SearchView.ts @@ -357,7 +357,6 @@ export class SearchView extends BaseTopLevelView implements TopLevelView new ContactEditor(locator.entityClient, getFirstOrThrow(this.searchViewModel.getSelectedContacts())).show(), - onDelete: deleteContacts, + onDelete: (contacts: Contact[]) => deleteContacts(contacts, () => this.searchViewModel.listModel.selectNone()), onMerge: confirmMerge, onExport: exportContacts, - selectNone: () => this.searchViewModel.listModel.selectNone(), }), ) }