From a4f8354633f7909231fa9845fcc43f3efdc6756c Mon Sep 17 00:00:00 2001 From: wrd Date: Fri, 15 Nov 2024 17:33:20 +0100 Subject: [PATCH] Add confirmation dialog before deleting label Close #7934 --- src/common/misc/TranslationKey.ts | 1 + src/mail-app/mail/view/MailView.ts | 12 +++++++++++- src/mail-app/translations/de.ts | 3 ++- src/mail-app/translations/de_sie.ts | 3 ++- src/mail-app/translations/en.ts | 3 ++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/common/misc/TranslationKey.ts b/src/common/misc/TranslationKey.ts index 6e288c8bba0..4792146aca3 100644 --- a/src/common/misc/TranslationKey.ts +++ b/src/common/misc/TranslationKey.ts @@ -1803,3 +1803,4 @@ export type TranslationKeyType = | "editLabel_action" | "importantLabel_label" | "labelLimitExceeded_msg" + | "confirmDeleteLabel_msg" diff --git a/src/mail-app/mail/view/MailView.ts b/src/mail-app/mail/view/MailView.ts index 941a31bbd86..d0c7e937d75 100644 --- a/src/mail-app/mail/view/MailView.ts +++ b/src/mail-app/mail/view/MailView.ts @@ -799,6 +799,16 @@ export class MailView extends BaseTopLevelView implements TopLevelView + lang.get("confirmDeleteLabel_msg", { + "{1}": label.name, + }), + ) + if (!confirmed) return + await this.mailViewModel.deleteLabel(label) + } + private renderMailboxLabelItems(mailboxDetail: MailboxDetail, inEditMode: boolean, onEditMailbox: () => void): Children { return [ m( @@ -842,7 +852,7 @@ export class MailView extends BaseTopLevelView implements TopLevelView { - this.mailViewModel.deleteLabel(label) + this.showLabelDeleteDialog(label) }, }, ], diff --git a/src/mail-app/translations/de.ts b/src/mail-app/translations/de.ts index 0b2a243637c..c9a23004a4b 100644 --- a/src/mail-app/translations/de.ts +++ b/src/mail-app/translations/de.ts @@ -1819,6 +1819,7 @@ export default { "yourCalendars_label": "Deine Kalender", "yourFolders_action": "DEINE ORDNER", "yourMessage_label": "Deine Nachricht", - "you_label": "Du" + "you_label": "Du", + "confirmDeleteLabel_msg": "Möchtest du wirklich das Label \"{1}\" löschen?" } } diff --git a/src/mail-app/translations/de_sie.ts b/src/mail-app/translations/de_sie.ts index a36e9b626b0..de4e39dec38 100644 --- a/src/mail-app/translations/de_sie.ts +++ b/src/mail-app/translations/de_sie.ts @@ -1819,6 +1819,7 @@ export default { "yourCalendars_label": "Deine Kalender", "yourFolders_action": "Ihre ORDNER", "yourMessage_label": "Ihre Nachricht", - "you_label": "Sie" + "you_label": "Sie", + "confirmDeleteLabel_msg": "Möchten Sie wirklich das Label \"{1}\" löschen?" } } diff --git a/src/mail-app/translations/en.ts b/src/mail-app/translations/en.ts index ed581fbebb7..7c3814b646a 100644 --- a/src/mail-app/translations/en.ts +++ b/src/mail-app/translations/en.ts @@ -1815,6 +1815,7 @@ export default { "yourCalendars_label": "Your calendars", "yourFolders_action": "YOUR FOLDERS", "yourMessage_label": "Your message", - "you_label": "You" + "you_label": "You", + "confirmDeleteLabel_msg": "Are you sure that you want to delete the label \"{1}\"?" } }