From 3566c1c3f6f708303ff322969cc822ff7b132b33 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 29 Apr 2016 18:10:15 +0300 Subject: [PATCH] Fixed empty found dialog problem --- app/js/messages_manager.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/js/messages_manager.js b/app/js/messages_manager.js index a6fed830..4164b65c 100644 --- a/app/js/messages_manager.js +++ b/app/js/messages_manager.js @@ -2887,21 +2887,18 @@ angular.module('myApp.services') messagesForDialogs[messageID].pFlags.unread = false; } if (!message.pFlags.out) { - if (foundDialog) { + if (foundDialog[0]) { newUnreadCount = --foundDialog[0].unread_count; } NotificationsManager.cancel('msg' + messageID); } } } - if (!isOut && foundDialog) { + if (!isOut && foundDialog[0]) { if (newUnreadCount && foundDialog[0].top_message <= maxID) { newUnreadCount = foundDialog[0].unread_count = 0; } - if (!foundDialog[0]) { - console.error('empty found dialog', foundDialog, update); - } foundDialog[0].read_inbox_max_id = maxID; } @@ -2972,7 +2969,7 @@ angular.module('myApp.services') angular.forEach(historiesUpdated, function (updatedData, peerID) { var foundDialog = getDialogByPeerID(peerID); - if (foundDialog) { + if (foundDialog[0]) { if (updatedData.unread) { foundDialog[0].unread_count -= updatedData.unread;