From fb3c090de20a379c34f89e082c52766119e01407 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 15 Jul 2021 14:30:16 +0200 Subject: [PATCH] confirm the leave room --- src/platform/web/ui/session/room/RoomView.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/platform/web/ui/session/room/RoomView.js b/src/platform/web/ui/session/room/RoomView.js index ccad448f..71eb1e13 100644 --- a/src/platform/web/ui/session/room/RoomView.js +++ b/src/platform/web/ui/session/room/RoomView.js @@ -70,7 +70,7 @@ export class RoomView extends TemplateView { const options = []; options.push(Menu.option(vm.i18n`Room details`, () => vm.openDetailsPanel())) if (vm.canLeave) { - options.push(Menu.option(vm.i18n`Leave room`, () => vm.leaveRoom()).setDestructive()); + options.push(Menu.option(vm.i18n`Leave room`, () => this._confirmToLeaveRoom()).setDestructive()); } if (vm.canForget) { options.push(Menu.option(vm.i18n`Forget room`, () => vm.forgetRoom()).setDestructive()); @@ -97,4 +97,10 @@ export class RoomView extends TemplateView { }); } } + + _confirmToLeaveRoom() { + if (confirm(this.value.i18n`Are you sure you want to leave "${this.value.name}"?`)) { + this.value.leaveRoom(); + } + } }