diff --git a/app/js/controllers.js b/app/js/controllers.js index f17810a2..b97130e7 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2735,9 +2735,17 @@ angular.module('myApp.controllers', ['myApp.i18n']) } var options = { - replyToMsgID: $scope.draftMessage.replyToMsgID + replyToMsgID: $scope.draftMessage.replyToMsgID, + clearDraft: true } AppInlineBotsManager.sendInlineResult($scope.curDialog.peerID, qID, options) + + if (forceDraft == $scope.curDialog.peer) { + forceDraft = false + } else { + DraftsManager.changeDraft($scope.curDialog.peerID) + } + fwdsSend() resetDraft() delete $scope.draftMessage.sticker @@ -4361,7 +4369,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) } }) - .controller('ContactsModalController', function ($scope, $timeout, $modal, $modalInstance, MtpApiManager, AppUsersManager, ErrorService) { + .controller('ContactsModalController', function ($scope, $rootScope, $timeout, $modal, $modalInstance, MtpApiManager, AppUsersManager, ErrorService) { $scope.contacts = [] $scope.foundPeers = [] $scope.search = {} @@ -4487,7 +4495,13 @@ angular.module('myApp.controllers', ['myApp.i18n']) } $scope.importContact = function () { - AppUsersManager.openImportContact() + AppUsersManager.openImportContact().then(function (foundContact) { + if (foundContact) { + $rootScope.$broadcast('history_focus', { + peerString: AppUsersManager.getUserString(foundContact) + }) + } + }) } }) diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index ef10010f..1f775d10 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -1775,6 +1775,9 @@ angular.module('myApp.services') if (asChannel) { flags |= 16 } + if (options.clearDraft) { + flags |= 128 + } var sentRequestOptions = {} if (pendingAfterMsgs[peerID]) { diff --git a/app/js/services.js b/app/js/services.js index 45a61e63..7c4429b9 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -16,10 +16,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) var usernames = {} var userAccess = {} var cachedPhotoLocations = {} - var contactsFillPromise, - contactsList - var contactsIndex = SearchIndexManager.createIndex(), - myID + var contactsIndex = SearchIndexManager.createIndex() + var contactsFillPromise + var contactsList + var myID MtpApiManager.getUserID().then(function (id) { myID = id @@ -363,8 +363,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } function onContactUpdated (userID, isContact) { + userID = parseInt(userID) if (angular.isArray(contactsList)) { - var curPos = curIsContact = contactsList.indexOf(parseInt(userID)) + var curPos = curIsContact = contactsList.indexOf(userID) var curIsContact = curPos != -1 if (isContact != curIsContact) { diff --git a/app/partials/desktop/import_contact_modal.html b/app/partials/desktop/import_contact_modal.html index fa18eacb..3d83c755 100644 --- a/app/partials/desktop/import_contact_modal.html +++ b/app/partials/desktop/import_contact_modal.html @@ -11,7 +11,7 @@ - +