Browse Source

Clear draft after sending inline result

Closes #1183
master
Igor Zhukov 8 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']) @@ -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']) @@ -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']) @@ -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)
})
}
})
}
})

3
app/js/messages_manager.js

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

11
app/js/services.js

@ -16,10 +16,10 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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']) @@ -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) {

2
app/partials/desktop/import_contact_modal.html

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
<span ng-switch-when="true" my-i18n="login_incorrect_number"></span>
<span ng-switch-default my-i18n="contact_import_modal_phone"></span>
</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 class="md-input-group" my-labeled-input>

Loading…
Cancel
Save