From 3371e500cc88fb4d7781e9d30a5bc72907ab024e Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Tue, 5 Jul 2016 18:59:00 +0300 Subject: [PATCH] Added confirm before leaving channel / supergroup --- app/js/controllers.js | 8 +++++--- app/js/locales/en-us.json | 2 ++ app/partials/desktop/confirm_modal.html | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index 1e1c1131..159f5fa4 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -3648,9 +3648,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) } $scope.leaveChannel = function () { - MtpApiManager.invokeApi('channels.leaveChannel', { - channel: AppChatsManager.getChannelInput($scope.chatID) - }).then(onChatUpdated) + return ErrorService.confirm({type: $scope.isMegagroup ? 'MEGAGROUP_LEAVE' : 'CHANNEL_LEAVE'}).then(function () { + MtpApiManager.invokeApi('channels.leaveChannel', { + channel: AppChatsManager.getChannelInput($scope.chatID) + }).then(onChatUpdated) + }) } $scope.deleteChannel = function () { diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 3cf04770..c6720e1c 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -216,6 +216,8 @@ "confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?", "confirm_modal_history_flush": "Are you sure? This can not be undone!", "confirm_modal_history_leave_flush_md": "Are you sure, you want to delete all message history and leave the group?\n\nThis action cannot be undone.", + "confirm_modal_leave_channel_md": "Are you sure, you want to leave this channel?\n\nThis action cannot be undone.", + "confirm_modal_leave_group_md": "Are you sure, you want to leave this group?\n\nThis action cannot be undone.", "confirm_modal_terminate_sessions": "Are you sure you want to log out all devices except for this one?", "confirm_modal_terminate_session": "Are you sure you want to log out this device?", "confirm_modal_clipboard_file_send": "Are you sure to send file(s) from clipboard?", diff --git a/app/partials/desktop/confirm_modal.html b/app/partials/desktop/confirm_modal.html index bf91f607..ea06200d 100644 --- a/app/partials/desktop/confirm_modal.html +++ b/app/partials/desktop/confirm_modal.html @@ -61,6 +61,8 @@
+
+