Improved readHistory

This commit is contained in:
Igor Zhukov 2014-06-25 12:44:55 +04:00
parent 9fda274d3b
commit fc7071098e

View File

@ -1119,7 +1119,7 @@ angular.module('myApp.services', [])
return historyStorage.readPromise; return historyStorage.readPromise;
} }
var promise = MtpApiManager.invokeApi('messages.readHistory', { historyStorage.readPromise = MtpApiManager.invokeApi('messages.readHistory', {
peer: inputPeer, peer: inputPeer,
offset: 0, offset: 0,
max_id: 0 max_id: 0
@ -1135,7 +1135,6 @@ angular.module('myApp.services', [])
delete historyStorage.readPromise; delete historyStorage.readPromise;
}); });
if (historyStorage && historyStorage.history.length) { if (historyStorage && historyStorage.history.length) {
var messageID, message, i, peerID, foundDialog, dialog; var messageID, message, i, peerID, foundDialog, dialog;
for (i = 0; i < historyStorage.history.length; i++) { for (i = 0; i < historyStorage.history.length; i++) {
@ -1153,7 +1152,7 @@ angular.module('myApp.services', [])
} }
} }
return promise; return historyStorage.readPromise;
} }
function flushHistory (inputPeer) { function flushHistory (inputPeer) {