Browse Source

Clear draft after sending inline result

Closes #1183
master
Igor Zhukov 9 years ago
parent
commit
758d1cb771
  1. 20
      app/js/controllers.js
  2. 3
      app/js/messages_manager.js
  3. 11
      app/js/services.js
  4. 2
      app/partials/desktop/import_contact_modal.html

20
app/js/controllers.js

@ -2735,9 +2735,17 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
var options = { var options = {
replyToMsgID: $scope.draftMessage.replyToMsgID replyToMsgID: $scope.draftMessage.replyToMsgID,
clearDraft: true
} }
AppInlineBotsManager.sendInlineResult($scope.curDialog.peerID, qID, options) AppInlineBotsManager.sendInlineResult($scope.curDialog.peerID, qID, options)
if (forceDraft == $scope.curDialog.peer) {
forceDraft = false
} else {
DraftsManager.changeDraft($scope.curDialog.peerID)
}
fwdsSend() fwdsSend()
resetDraft() resetDraft()
delete $scope.draftMessage.sticker 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.contacts = []
$scope.foundPeers = [] $scope.foundPeers = []
$scope.search = {} $scope.search = {}
@ -4487,7 +4495,13 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
$scope.importContact = function () { $scope.importContact = function () {
AppUsersManager.openImportContact() AppUsersManager.openImportContact().then(function (foundContact) {
if (foundContact) {
$rootScope.$broadcast('history_focus', {
peerString: AppUsersManager.getUserString(foundContact)
})
}
})
} }
}) })

3
app/js/messages_manager.js

@ -1775,6 +1775,9 @@ angular.module('myApp.services')
if (asChannel) { if (asChannel) {
flags |= 16 flags |= 16
} }
if (options.clearDraft) {
flags |= 128
}
var sentRequestOptions = {} var sentRequestOptions = {}
if (pendingAfterMsgs[peerID]) { if (pendingAfterMsgs[peerID]) {

11
app/js/services.js

@ -16,10 +16,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
var usernames = {} var usernames = {}
var userAccess = {} var userAccess = {}
var cachedPhotoLocations = {} var cachedPhotoLocations = {}
var contactsFillPromise, var contactsIndex = SearchIndexManager.createIndex()
contactsList var contactsFillPromise
var contactsIndex = SearchIndexManager.createIndex(), var contactsList
myID var myID
MtpApiManager.getUserID().then(function (id) { MtpApiManager.getUserID().then(function (id) {
myID = id myID = id
@ -363,8 +363,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
} }
function onContactUpdated (userID, isContact) { function onContactUpdated (userID, isContact) {
userID = parseInt(userID)
if (angular.isArray(contactsList)) { if (angular.isArray(contactsList)) {
var curPos = curIsContact = contactsList.indexOf(parseInt(userID)) var curPos = curIsContact = contactsList.indexOf(userID)
var curIsContact = curPos != -1 var curIsContact = curPos != -1
if (isContact != curIsContact) { if (isContact != curIsContact) {

2
app/partials/desktop/import_contact_modal.html

@ -11,7 +11,7 @@
<span ng-switch-when="true" my-i18n="login_incorrect_number"></span> <span ng-switch-when="true" my-i18n="login_incorrect_number"></span>
<span ng-switch-default my-i18n="contact_import_modal_phone"></span> <span ng-switch-default my-i18n="contact_import_modal_phone"></span>
</label> </label>
<input class="md-input" my-focused type="tel" ng-model="importContact.phone" ng-pattern="/^[-\+\(\)\d]{7,32}$/" my-submit-on-enter name="phone" /> <input class="md-input" my-focused type="tel" ng-model="importContact.phone" ng-pattern="/^[-\+\(\)\d\s]{7,32}$/" my-submit-on-enter name="phone" />
</div> </div>
<div class="md-input-group" my-labeled-input> <div class="md-input-group" my-labeled-input>

Loading…
Cancel
Save