Browse Source

Bugfixes

master
Igor Zhukov 9 years ago
parent
commit
f41e55cd16
  1. 4
      app/js/controllers.js
  2. 20
      app/js/messages_manager.js

4
app/js/controllers.js

@ -749,7 +749,9 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -749,7 +749,9 @@ angular.module('myApp.controllers', ['myApp.i18n'])
case 'updateUserTyping':
case 'updateChatUserTyping':
if (!AppUsersManager.hasUser(update.user_id)) {
if (update.chat_id) {
if (update.chat_id &&
AppChatsManager.hasChat(update.chat_id) &&
!AppChatsManager.isChannel(update.chat_id)) {
AppProfileManager.getChatFull(update.chat_id);
}
return;

20
app/js/messages_manager.js

@ -70,6 +70,9 @@ angular.module('myApp.services') @@ -70,6 +70,9 @@ angular.module('myApp.services')
var dialogsNum = 0;
var minDialogsIndex = Math.pow(2, 50);
var migratedFrom = {};
var migratedTo = {};
function getConversations (query, offsetIndex, limit) {
var curDialogStorage = dialogsStorage;
var isSearch = angular.isString(query) && query.length;
@ -227,6 +230,15 @@ angular.module('myApp.services') @@ -227,6 +230,15 @@ angular.module('myApp.services')
saveChannelDialog(channelID, dialog);
ApiUpdatesManager.addChannelState(channelID, dialog.pts);
} else {
if (peerID < 0) {
var chat = AppChatsManager.getChat(-peerID);
if (chat && chat.migrated_to && chat.pFlags.deactivated) {
var migratedToPeer = AppPeersManager.getPeerID(chat.migrated_to);
migratedFrom[peerID] = migratedToPeer;
migratedTo[migratedToPeer] = peerID;
return;
}
}
var peerText = AppPeersManager.getPeerSearchText(peerID);
SearchIndexManager.indexObject(peerID, peerText, dialogsIndex);
@ -464,6 +476,11 @@ angular.module('myApp.services') @@ -464,6 +476,11 @@ angular.module('myApp.services')
// console.log('fill history storage', inputPeer, maxID, fullLimit, angular.copy(historyStorage));
return requestHistory (inputPeer, maxID, fullLimit).then(function (historyResult) {
historyStorage.count = historyResult.count || historyResult.messages.length;
var peerID = AppPeersManager.getPeerID(inputPeer);
var migratedFromPeer = migratedTo[peerID];
// if () {
// historyStorage.count++;
// }
var offset = 0;
if (!maxID && historyResult.messages.length) {
@ -487,7 +504,8 @@ angular.module('myApp.services') @@ -487,7 +504,8 @@ angular.module('myApp.services')
fullLimit -= historyResult.messages.length;
if (fullLimit > 0 && historyStorage.history.length < historyStorage.count) {
if (fullLimit > 0 &&
(historyStorage.history.length < historyStorage.count || migratedFromPeer)) {
maxID = historyStorage.history[historyStorage.history.length - 1];
return fillHistoryStorage(inputPeer, maxID, fullLimit, historyStorage);
}

Loading…
Cancel
Save