Add a confirmation before conversation deletion

Closes #383

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-03-04 17:39:50 +01:00
parent 03596f2db7
commit e125dcc76e
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
3 changed files with 22 additions and 3 deletions

View File

@ -957,5 +957,8 @@
"The group's banner was changed.": "The group's banner was changed.", "The group's banner was changed.": "The group's banner was changed.",
"The group's short description was changed.": "The group's short description was changed.", "The group's short description was changed.": "The group's short description was changed.",
"No information": "No information", "No information": "No information",
"@{username}'s follow request was accepted": "@{username}'s follow request was accepted" "@{username}'s follow request was accepted": "@{username}'s follow request was accepted",
"Delete this discussion": "Delete this discussion",
"Are you sure you want to delete this entire discussion?": "Are you sure you want to delete this entire discussion?",
"Delete discussion": "Delete discussion"
} }

View File

@ -1051,5 +1051,8 @@
"{username} was invited to {group}": "{username} a été invité à {group}", "{username} was invited to {group}": "{username} a été invité à {group}",
"© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap", "© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap",
"No information": "Non renseigné", "No information": "Non renseigné",
"@{username}'s follow request was accepted": "@{username}'s follow request was accepted" "@{username}'s follow request was accepted": "@{username}'s follow request was accepted",
"Delete this discussion": "Supprimer cette discussion",
"Are you sure you want to delete this entire discussion?": "Êtes-vous certain⋅e de vouloir supprimer l'entièreté de cette discussion ?",
"Delete discussion": "Supprimer la discussion"
} }

View File

@ -79,7 +79,7 @@
icon-right="close" icon-right="close"
/> />
<b-button <b-button
@click="deleteConversation" @click="openDeleteDiscussionConfirmation"
type="is-danger" type="is-danger"
native-type="button" native-type="button"
icon-left="delete" icon-left="delete"
@ -388,6 +388,19 @@ export default class discussion extends mixins(GroupMixin) {
this.editTitleMode = false; this.editTitleMode = false;
} }
openDeleteDiscussionConfirmation(): void {
this.$buefy.dialog.confirm({
type: "is-danger",
title: this.$t("Delete this discussion") as string,
message: this.$t(
"Are you sure you want to delete this entire discussion?"
) as string,
confirmText: this.$t("Delete discussion") as string,
cancelText: this.$t("Cancel") as string,
onConfirm: () => this.deleteConversation(),
});
}
async deleteConversation(): Promise<void> { async deleteConversation(): Promise<void> {
await this.$apollo.mutate({ await this.$apollo.mutate({
mutation: DELETE_DISCUSSION, mutation: DELETE_DISCUSSION,