From fc7071098e2e0b8a2d03a08b8c5dcacd10d3c614 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 25 Jun 2014 12:44:55 +0400 Subject: [PATCH] Improved readHistory --- app/js/services.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/js/services.js b/app/js/services.js index f67d2f48..68c1e54b 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -1119,7 +1119,7 @@ angular.module('myApp.services', []) return historyStorage.readPromise; } - var promise = MtpApiManager.invokeApi('messages.readHistory', { + historyStorage.readPromise = MtpApiManager.invokeApi('messages.readHistory', { peer: inputPeer, offset: 0, max_id: 0 @@ -1135,7 +1135,6 @@ angular.module('myApp.services', []) delete historyStorage.readPromise; }); - if (historyStorage && historyStorage.history.length) { var messageID, message, i, peerID, foundDialog, dialog; for (i = 0; i < historyStorage.history.length; i++) { @@ -1153,7 +1152,7 @@ angular.module('myApp.services', []) } } - return promise; + return historyStorage.readPromise; } function flushHistory (inputPeer) {