Browse Source

Fixed edit pending message

master
Igor Zhukov 9 years ago
parent
commit
c042d26080
  1. 21
      app/js/directives.js

21
app/js/directives.js

@ -257,33 +257,32 @@ angular.module('myApp.directives', ['myApp.filters'])
}); });
} }
function updateMessageBody($scope, element, message) {
updateMessageText($scope, element, message);
updateMessageMedia($scope, element, message);
updateMessageKeyboard($scope, element, message);
}
function link ($scope, element, attrs) { function link ($scope, element, attrs) {
var message = $scope.message; var message = $scope.message;
message.dir = true; message.dir = true;
var msgID = message.mid; var msgID = message.mid;
updateMessageText($scope, element, message); updateMessageBody($scope, element, message);
updateMessageMedia($scope, element, message);
updateMessageKeyboard($scope, element, message);
if (message.pending) { if (message.pending) {
var unlink = $scope.$on('messages_pending', function () { var unlink = $scope.$on('messages_pending', function () {
if (message.mid != msgID) { if (message.mid != msgID) {
updateMessageText($scope, element, message); updateMessageBody($scope, element, message);
unlink(); unlink();
} }
}); });
} }
$scope.$on('message_edit', function (e, data) { $scope.$on('message_edit', function (e, data) {
if (data.mid != message.mid) { if (data.mid == message.mid) {
return; updateMessageBody($scope, element, message);
} }
// console.log(dT(), 'Directive' edit', message);
updateMessageText($scope, element, message);
updateMessageMedia($scope, element, message);
updateMessageKeyboard($scope, element, message);
$scope.$emit('ui_height');
}); });
} }
}) })

Loading…
Cancel
Save