Browse Source

Fixed empty found dialog problem

master
Igor Zhukov 9 years ago
parent
commit
3566c1c3f6
  1. 9
      app/js/messages_manager.js

9
app/js/messages_manager.js

@ -2887,21 +2887,18 @@ angular.module('myApp.services')
messagesForDialogs[messageID].pFlags.unread = false; messagesForDialogs[messageID].pFlags.unread = false;
} }
if (!message.pFlags.out) { if (!message.pFlags.out) {
if (foundDialog) { if (foundDialog[0]) {
newUnreadCount = --foundDialog[0].unread_count; newUnreadCount = --foundDialog[0].unread_count;
} }
NotificationsManager.cancel('msg' + messageID); NotificationsManager.cancel('msg' + messageID);
} }
} }
} }
if (!isOut && foundDialog) { if (!isOut && foundDialog[0]) {
if (newUnreadCount && if (newUnreadCount &&
foundDialog[0].top_message <= maxID) { foundDialog[0].top_message <= maxID) {
newUnreadCount = foundDialog[0].unread_count = 0; newUnreadCount = foundDialog[0].unread_count = 0;
} }
if (!foundDialog[0]) {
console.error('empty found dialog', foundDialog, update);
}
foundDialog[0].read_inbox_max_id = maxID; foundDialog[0].read_inbox_max_id = maxID;
} }
@ -2972,7 +2969,7 @@ angular.module('myApp.services')
angular.forEach(historiesUpdated, function (updatedData, peerID) { angular.forEach(historiesUpdated, function (updatedData, peerID) {
var foundDialog = getDialogByPeerID(peerID); var foundDialog = getDialogByPeerID(peerID);
if (foundDialog) { if (foundDialog[0]) {
if (updatedData.unread) { if (updatedData.unread) {
foundDialog[0].unread_count -= updatedData.unread; foundDialog[0].unread_count -= updatedData.unread;

Loading…
Cancel
Save