Skip to content

Commit

Permalink
Add confirmation dialog before deleting label
Browse files Browse the repository at this point in the history
Close #7934
  • Loading branch information
wrdhub committed Nov 15, 2024
1 parent 938ce86 commit ba142d7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/common/misc/TranslationKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1800,5 +1800,4 @@ export type TranslationKeyType =
| "yourMessage_label"
| "you_label"
| "emptyString_msg"
| "editLabel_action"
| "importantLabel_label"
| "confirmDeleteLabel_msg"
12 changes: 11 additions & 1 deletion src/mail-app/mail/view/MailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,16 @@ export class MailView extends BaseTopLevelView implements TopLevelView<MailViewA
await showEditLabelDialog(null, this.mailViewModel, label)
}

private async showLabelDeleteDialog(label: MailFolder) {
const confirmed = await Dialog.confirm(() =>
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(
Expand Down Expand Up @@ -842,7 +852,7 @@ export class MailView extends BaseTopLevelView implements TopLevelView<MailViewA
label: "delete_action",
icon: Icons.Trash,
click: () => {
this.mailViewModel.deleteLabel(label)
this.showLabelDeleteDialog(label)
},
},
],
Expand Down
3 changes: 2 additions & 1 deletion src/mail-app/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
}
}
3 changes: 2 additions & 1 deletion src/mail-app/translations/de_sie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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?"
}
}
3 changes: 2 additions & 1 deletion src/mail-app/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"?"
}
}

0 comments on commit ba142d7

Please sign in to comment.