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
3 changed files with 22 additions and 3 deletions

View File

@@ -79,7 +79,7 @@
icon-right="close"
/>
<b-button
@click="deleteConversation"
@click="openDeleteDiscussionConfirmation"
type="is-danger"
native-type="button"
icon-left="delete"
@@ -388,6 +388,19 @@ export default class discussion extends mixins(GroupMixin) {
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> {
await this.$apollo.mutate({
mutation: DELETE_DISCUSSION,