Update dialog upon edit of top message. Fix #1177

This commit is contained in:
John Yong 2017-04-01 12:21:44 +08:00
parent 6e6c74c5c1
commit e3eed60b07

View File

@ -3017,10 +3017,10 @@ angular.module('myApp.services')
messagesForHistory[mid] = wasForHistory messagesForHistory[mid] = wasForHistory
} }
var foundDialog = getDialogByPeerID(peerID)[0]
var isTopMessage = foundDialog && foundDialog.top_message == mid
if (message.clear_history) { if (message.clear_history) {
var foundDialog = getDialogByPeerID(peerID) if (isTopMessage) {
if (foundDialog[0] &&
foundDialog[0].top_message == mid) {
$rootScope.$broadcast('dialog_flush', {peerID: peerID}) $rootScope.$broadcast('dialog_flush', {peerID: peerID})
} else { } else {
$rootScope.$broadcast('history_delete', {peerID: peerID, msgs: [mid]}) $rootScope.$broadcast('history_delete', {peerID: peerID, msgs: [mid]})
@ -3031,6 +3031,11 @@ angular.module('myApp.services')
id: message.id, id: message.id,
mid: mid mid: mid
}) })
if (isTopMessage) {
var updatedDialogs = {}
updatedDialogs[peerID] = foundDialog
$rootScope.$broadcast('dialogs_multiupdate', updatedDialogs)
}
} }
break break