Browse Source

Improved update handling

master
Igor Zhukov 9 years ago
parent
commit
a3a6996343
  1. 26
      app/js/messages_manager.js

26
app/js/messages_manager.js

@ -2780,16 +2780,18 @@ angular.module('myApp.services')
case 'updateEditMessage': case 'updateEditMessage':
case 'updateEditChannelMessage': case 'updateEditChannelMessage':
var message = update.message, var message = update.message;
peerID = getMessagePeer(message), var peerID = getMessagePeer(message);
historyStorage = historiesStorage[peerID]; var channelID = message.to_id._ == 'peerChannel' ? -peerID : 0;
var mid = getFullMessageID(message.id, channelID);
if (messagesStorage[mid] === undefined) {
break;
}
saveMessages([message], true); saveMessages([message], true);
var mid = message.mid; safeReplaceObject(messagesStorage[mid], message);
if (messagesStorage[mid] !== undefined) { messagesStorage[mid] = message;
safeReplaceObject(messagesStorage[mid], message);
messagesStorage[mid] = message;
}
if (messagesForHistory[mid] !== undefined) { if (messagesForHistory[mid] !== undefined) {
var wasForHistory = messagesForHistory[mid]; var wasForHistory = messagesForHistory[mid];
delete messagesForHistory[mid]; delete messagesForHistory[mid];
@ -2797,13 +2799,7 @@ angular.module('myApp.services')
safeReplaceObject(wasForHistory, newForHistory); safeReplaceObject(wasForHistory, newForHistory);
messagesForHistory[mid] = newForHistory; messagesForHistory[mid] = newForHistory;
} }
// if (messagesForDialogs[mid] !== undefined) { $rootScope.$broadcast('message_edit', {peerID: peerID, id: message.id, mid: mid});
// var wasForHistory = messagesForDialogs[mid];
// delete messagesForDialogs[mid];
// var newForHistory = wrapForHistory(message);
// safeReplaceObject(wasForHistory, newForHistory);
// messagesForDialogs[mid] = newForHistory;
// }
break; break;
case 'updateReadHistoryInbox': case 'updateReadHistoryInbox':

Loading…
Cancel
Save