From e07faa0c8ab8cf2c635a02b3aafd3d03617f5cef Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 22 Apr 2016 20:08:41 +0300 Subject: [PATCH] Added quick forward --- app/js/controllers.js | 29 +++++++++++++++++++++++++++-- app/js/locales/en-us.json | 1 + 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index 912a41ce..bdc07bc1 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1047,7 +1047,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) }) - .controller('AppImHistoryController', function ($scope, $location, $timeout, $modal, $rootScope, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, PeersSelectService, IdleManager, StatusManager, NotificationsManager, ErrorService, GeoLocationManager) { + .controller('AppImHistoryController', function ($scope, $location, $timeout, $modal, $rootScope, toaster, _, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ApiUpdatesManager, PeersSelectService, IdleManager, StatusManager, NotificationsManager, ErrorService, GeoLocationManager) { $scope.$watchCollection('curDialog', applyDialogSelect); @@ -1581,7 +1581,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) if ($scope.historyState.canReply) { selectedReply(messageID); } else { - selectedForward(messageID); + quickForward(messageID); } return false; } @@ -1720,6 +1720,31 @@ angular.module('myApp.controllers', ['myApp.i18n']) } } + function quickForward(msgID) { + PeersSelectService.selectPeers({ + canSend: true, + confirm_type: 'FORWARD_PEER' + }).then(function (peerStrings) { + angular.forEach(peerStrings, function (peerString) { + var peerID = AppPeersManager.getPeerID(peerString); + AppMessagesManager.forwardMessages(peerID, [msgID]); + }); + var toastData = toaster.pop({ + type: 'info', + body: _('confirm_modal_forward_to_peer_success'), + bodyOutputType: 'trustedHtml', + clickHandler: function () { + $rootScope.$broadcast('history_focus', { + peerString: peerStrings[0] + }); + toaster.clear(toastData); + }, + showCloseButton: false + }); + + }); + } + function selectedForward (selectedMessageID) { var selectedMessageIDs = []; if (selectedMessageID) { diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 553ebfce..41964265 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -217,6 +217,7 @@ "confirm_modal_contacts_import": "Telegram will now sync your contacts in order to find your friends.", "confirm_modal_login_phone_correct": "Is this phone number correct?", "confirm_modal_forward_to_peer": "Forward to {peer}?", + "confirm_modal_forward_to_peer_success": "Message was successfully forwarded.", "confirm_modal_send_to_peer": "Send to {peer}?", "confirm_modal_share_file_peer": "Share with {peer}?", "confirm_modal_invite_peer": "Invite to {peer}?",