From 607639a6a845b2a45da9519ea3b0edc27e96b071 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Sun, 19 Oct 2014 11:36:28 +0200 Subject: [PATCH] Fixed message send --- app/js/controllers.js | 5 +---- app/js/directives.js | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index 49060de7..c68b7bb9 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1377,13 +1377,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.$on('user_update', angular.noop); $scope.$on('ui_typing', onTyping); - $scope.draftMessage = {text: ''}; + $scope.draftMessage = {text: '', send: sendMessage}; $scope.$watch('draftMessage.text', onMessageChange); $scope.$watch('draftMessage.files', onFilesSelected); - - $scope.sendMessage = sendMessage; - function sendMessage (e) { $scope.$broadcast('ui_message_before_send'); diff --git a/app/js/directives.js b/app/js/directives.js index dbf5b4b2..80381a19 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -954,7 +954,7 @@ angular.module('myApp.directives', ['myApp.filters']) if (submit) { $timeout.cancel(updatePromise); updateValue(); - $(element).trigger('submit'); + $scope.draftMessage.send(); $(element).trigger('message_send'); resetAfterSubmit(); return cancelEvent(e); @@ -966,7 +966,7 @@ angular.module('myApp.directives', ['myApp.filters']) $(submitBtn).on('mousedown touchstart', function (e) { $timeout.cancel(updatePromise); updateValue(); - $(element).trigger('submit'); + $scope.draftMessage.send(); $(element).trigger('message_send'); resetAfterSubmit(); return cancelEvent(e);