From 05c18f077f81c3cd8595d1a14bd6022894b777f0 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 30 Mar 2015 21:41:00 +0300 Subject: [PATCH] Fixed deleted message reply --- app/js/directives.js | 4 ++++ app/js/services.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/js/directives.js b/app/js/directives.js index 37b56787..52d24252 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -356,6 +356,10 @@ angular.module('myApp.directives', ['myApp.filters']) function updateMessage($scope, element) { var message = $scope.replyMessage; + if (!message || message.deleted || !message.to_id) { + $(element).remove(); + return; + } var thumbWidth = 42; var thumbHeight = 42; var thumbPhotoSize; diff --git a/app/js/services.js b/app/js/services.js index 5a1e3935..ab978ee6 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -1943,7 +1943,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) return messagesForDialogs[msgID]; } - var message = angular.copy(messagesStorage[msgID]) || {id: msgID}; + var message = angular.copy(messagesStorage[msgID]); + + if (!message || !message.to_id) { + return message; + } if (message.chatID = message.to_id.chat_id) { message.peerID = -message.chatID;