MessagesManager bugfixes

Fixed forwardMessages bug, dropped messages bug
This commit is contained in:
Igor Zhukov 2014-06-16 17:18:23 +04:00
parent c57597d3b5
commit 666f4e5c39
2 changed files with 13 additions and 7 deletions

View File

@ -325,7 +325,7 @@ angular.module('myApp.directives', ['myApp.filters'])
})
.directive('myHistory', function ($window, $timeout, $transition) {
.directive('myHistory', function ($window, $timeout, $rootScope, $transition) {
return {
link: link
@ -370,7 +370,7 @@ angular.module('myApp.directives', ['myApp.filters'])
}
}
var animated = transform ? true : false,
var animated = transform && !$rootScope.idle.isIDLE ? true : false,
curAnimation = false;
$scope.$on('ui_history_append_new', function (e, options) {

View File

@ -1662,7 +1662,7 @@ angular.module('myApp.services', [])
}
function forwardMessages (peerID, msgIDs) {
msgIDs = $filter('orderBy')(msgIDs);
msgIDs = msgIDs.sort();
return MtpApiManager.invokeApi('messages.forwardMessages', {
peer: AppPeersManager.getInputPeerByID(peerID),
@ -1987,11 +1987,19 @@ angular.module('myApp.services', [])
if (historyStorage !== undefined) {
var topMsgID = historiesStorage[peerID].history[0];
if (message.id <= topMsgID) {
if (historiesStorage[peerID].history.indexOf(message.id) != -1) {
return false;
}
else {
historyStorage.history.unshift(message.id);
if (message.id > 0 && message.id < topMsgID || true) {
historyStorage.history.sort(function (a, b) {
return b - a;
});
}
}
} else {
historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []};
historyStorage = historiesStorage[peerID] = {count: null, history: [message.id], pending: []};
}
saveMessages([message]);
@ -2000,11 +2008,9 @@ angular.module('myApp.services', [])
historyStorage.count++;
}
historyStorage.history.unshift(message.id);
var randomID = pendingByMessageID[message.id],
pendingMessage;
if (randomID) {
if (pendingMessage = finalizePendingMessage(randomID, message)) {
$rootScope.$broadcast('history_update', {peerID: peerID});