Browse Source

Improved loading merged history

master
Igor Zhukov 9 years ago
parent
commit
9349724b46
  1. 34
      app/js/controllers.js
  2. 14
      app/js/lib/tl_utils.js
  3. 113
      app/js/messages_manager.js
  4. 2
      app/js/services.js

34
app/js/controllers.js

@ -1111,9 +1111,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$rootScope.selectedPeerID = peerID; $rootScope.selectedPeerID = peerID;
$scope.curDialog.peerID = peerID; $scope.curDialog.peerID = peerID;
$scope.curDialog.inputPeer = AppPeersManager.getInputPeer(newPeer);
$scope.historyFilter.mediaType = false; $scope.historyFilter.mediaType = false;
AppPeersManager.getInputPeer(newPeer);
updateBotActions(); updateBotActions();
selectedCancel(true); selectedCancel(true);
@ -1309,7 +1310,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
curLessJump = ++lessJump, curLessJump = ++lessJump,
limit = 0, limit = 0,
backLimit = 20; backLimit = 20;
AppMessagesManager.getHistory($scope.curDialog.inputPeer, minID, limit, backLimit).then(function (historyResult) { AppMessagesManager.getHistory($scope.curDialog.peerID, minID, limit, backLimit).then(function (historyResult) {
lessActive = false; lessActive = false;
if (curJump != jump || curLessJump != lessJump) return; if (curJump != jump || curLessJump != lessJump) return;
@ -1358,8 +1359,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
inputMediaFilter = $scope.historyFilter.mediaType && {_: inputMediaFilters[$scope.historyFilter.mediaType]}, inputMediaFilter = $scope.historyFilter.mediaType && {_: inputMediaFilters[$scope.historyFilter.mediaType]},
limit = Config.Mobile ? 20 : 0, limit = Config.Mobile ? 20 : 0,
getMessagesPromise = inputMediaFilter getMessagesPromise = inputMediaFilter
? AppMessagesManager.getSearch($scope.curDialog.inputPeer, '', inputMediaFilter, maxID, limit) ? AppMessagesManager.getSearch($scope.curDialog.peerID, '', inputMediaFilter, maxID, limit)
: AppMessagesManager.getHistory($scope.curDialog.inputPeer, maxID, limit); : AppMessagesManager.getHistory($scope.curDialog.peerID, maxID, limit);
getMessagesPromise.then(function (historyResult) { getMessagesPromise.then(function (historyResult) {
moreActive = false; moreActive = false;
@ -1425,8 +1426,8 @@ angular.module('myApp.controllers', ['myApp.i18n'])
var curJump = ++jump, var curJump = ++jump,
inputMediaFilter = $scope.historyFilter.mediaType && {_: inputMediaFilters[$scope.historyFilter.mediaType]}, inputMediaFilter = $scope.historyFilter.mediaType && {_: inputMediaFilters[$scope.historyFilter.mediaType]},
getMessagesPromise = inputMediaFilter getMessagesPromise = inputMediaFilter
? AppMessagesManager.getSearch($scope.curDialog.inputPeer, '', inputMediaFilter, maxID) ? AppMessagesManager.getSearch($scope.curDialog.peerID, '', inputMediaFilter, maxID)
: AppMessagesManager.getHistory($scope.curDialog.inputPeer, maxID, limit, backLimit, prerenderedLen); : AppMessagesManager.getHistory($scope.curDialog.peerID, maxID, limit, backLimit, prerenderedLen);
$scope.state.mayBeHasMore = true; $scope.state.mayBeHasMore = true;
@ -1491,7 +1492,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
}, 2800); }, 2800);
} }
AppMessagesManager.readHistory($scope.curDialog.inputPeer); AppMessagesManager.readHistory($scope.curDialog.peerID);
updateBotActions(); updateBotActions();
updateChannelActions(); updateChannelActions();
@ -1666,7 +1667,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function selectedFlush () { function selectedFlush () {
ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () { ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () {
AppMessagesManager.flushHistory($scope.curDialog.inputPeer).then(function () { AppMessagesManager.flushHistory($scope.curDialog.peerID).then(function () {
selectedCancel(); selectedCancel();
}); });
}) })
@ -1860,7 +1861,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
} else { } else {
$timeout(function () { $timeout(function () {
AppMessagesManager.readHistory($scope.curDialog.inputPeer); AppMessagesManager.readHistory($scope.curDialog.peerID);
}); });
} }
@ -1957,7 +1958,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
} else { } else {
$timeout(function () { $timeout(function () {
AppMessagesManager.readHistory($scope.curDialog.inputPeer); AppMessagesManager.readHistory($scope.curDialog.peerID);
}); });
} }
@ -2045,7 +2046,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$rootScope.$watch('idle.isIDLE', function (newVal) { $rootScope.$watch('idle.isIDLE', function (newVal) {
if (!newVal && $scope.curDialog && $scope.curDialog.peerID && !$scope.historyFilter.mediaType && !$scope.historyState.skipped) { if (!newVal && $scope.curDialog && $scope.curDialog.peerID && !$scope.historyFilter.mediaType && !$scope.historyState.skipped) {
AppMessagesManager.readHistory($scope.curDialog.inputPeer); AppMessagesManager.readHistory($scope.curDialog.peerID);
} }
if (!newVal) { if (!newVal) {
unreadAfterIdle = false; unreadAfterIdle = false;
@ -2370,7 +2371,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
if (newVal && newVal.length) { if (newVal && newVal.length) {
if (!$scope.historyFilter.mediaType && !$scope.historyState.skipped) { if (!$scope.historyFilter.mediaType && !$scope.historyState.skipped) {
AppMessagesManager.readHistory($scope.curDialog.inputPeer); AppMessagesManager.readHistory($scope.curDialog.peerID);
} }
var backupDraftObj = {}; var backupDraftObj = {};
@ -2384,11 +2385,12 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
function onTyping () { function onTyping () {
if ($scope.curDialog.inputPeer._ == 'inputPeerChannel') { if (AppPeersManager.isChannel($scope.curDialog.peerID) &&
!AppPeersManager.isMegagroup($scope.curDialog.peerID)) {
return false; return false;
} }
MtpApiManager.invokeApi('messages.setTyping', { MtpApiManager.invokeApi('messages.setTyping', {
peer: $scope.curDialog.inputPeer, peer: AppPeersManager.getInputPeerByID($scope.curDialog.peerID),
action: {_: 'sendMessageTypingAction'} action: {_: 'sendMessageTypingAction'}
}); });
} }
@ -3078,7 +3080,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.flushHistory = function () { $scope.flushHistory = function () {
ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () { ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () {
AppMessagesManager.flushHistory(AppPeersManager.getInputPeerByID($scope.userID)).then(function () { AppMessagesManager.flushHistory($scope.userID).then(function () {
$scope.goToHistory(); $scope.goToHistory();
}); });
}); });
@ -3238,7 +3240,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.flushHistory = function () { $scope.flushHistory = function () {
ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () { ErrorService.confirm({type: 'HISTORY_FLUSH'}).then(function () {
AppMessagesManager.flushHistory(AppPeersManager.getInputPeerByID(-$scope.chatID)).then(function () { AppMessagesManager.flushHistory(-$scope.chatID).then(function () {
$rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString}); $rootScope.$broadcast('history_focus', {peerString: $scope.chatFull.peerString});
}); });
}); });

14
app/js/lib/tl_utils.js

@ -518,8 +518,18 @@ TLDeserialization.prototype.fetchObject = function (type, field) {
if (type.substr(0, 6) == 'Vector' || type.substr(0, 6) == 'vector') { if (type.substr(0, 6) == 'Vector' || type.substr(0, 6) == 'vector') {
if (type.charAt(0) == 'V') { if (type.charAt(0) == 'V') {
var constructor = this.readInt(field + '[id]'); var constructor = this.readInt(field + '[id]'),
if (constructor != 0x1cb5c415) { constructorCmp = uintToInt(constructor);
if (constructorCmp == 0x3072cfa1) { // Gzip packed
var compressed = this.fetchBytes(field + '[packed_string]'),
uncompressed = gzipUncompress(compressed),
buffer = bytesToArrayBuffer(uncompressed),
newDeserializer = (new TLDeserialization(buffer));
return newDeserializer.fetchObject(type, field);
}
if (constructorCmp != 0x1cb5c415) {
throw new Error('Invalid vector constructor ' + constructor); throw new Error('Invalid vector constructor ' + constructor);
} }
} }

113
app/js/messages_manager.js

@ -70,8 +70,8 @@ angular.module('myApp.services')
var dialogsNum = 0; var dialogsNum = 0;
var minDialogsIndex = Math.pow(2, 50); var minDialogsIndex = Math.pow(2, 50);
var migratedFrom = {}; var migratedFromTo = {};
var migratedTo = {}; var migratedToFrom = {};
function getConversations (query, offsetIndex, limit) { function getConversations (query, offsetIndex, limit) {
var curDialogStorage = dialogsStorage; var curDialogStorage = dialogsStorage;
@ -234,8 +234,8 @@ angular.module('myApp.services')
var chat = AppChatsManager.getChat(-peerID); var chat = AppChatsManager.getChat(-peerID);
if (chat && chat.migrated_to && chat.pFlags.deactivated) { if (chat && chat.migrated_to && chat.pFlags.deactivated) {
var migratedToPeer = AppPeersManager.getPeerID(chat.migrated_to); var migratedToPeer = AppPeersManager.getPeerID(chat.migrated_to);
migratedFrom[peerID] = migratedToPeer; migratedFromTo[peerID] = migratedToPeer;
migratedTo[migratedToPeer] = peerID; migratedToFrom[migratedToPeer] = peerID;
return; return;
} }
} }
@ -323,8 +323,7 @@ angular.module('myApp.services')
} }
} }
function requestHistory (inputPeer, maxID, limit, offset) { function requestHistory (peerID, maxID, limit, offset) {
var peerID = AppPeersManager.getPeerID(inputPeer);
var isChannel = AppPeersManager.isChannel(peerID); var isChannel = AppPeersManager.isChannel(peerID);
var isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID); var isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID);
@ -341,7 +340,7 @@ angular.module('myApp.services')
}); });
} else { } else {
promise = MtpApiManager.invokeApi('messages.getHistory', { promise = MtpApiManager.invokeApi('messages.getHistory', {
peer: inputPeer, peer: AppPeersManager.getInputPeerByID(peerID),
offset_id: maxID ? getMessageLocalID(maxID) : 0, offset_id: maxID ? getMessageLocalID(maxID) : 0,
add_offset: offset || 0, add_offset: offset || 0,
limit: limit || 0 limit: limit || 0
@ -472,15 +471,14 @@ angular.module('myApp.services')
}; };
} }
function fillHistoryStorage (inputPeer, maxID, fullLimit, historyStorage) { function fillHistoryStorage (peerID, maxID, fullLimit, historyStorage) {
// console.log('fill history storage', inputPeer, maxID, fullLimit, angular.copy(historyStorage)); // console.log('fill history storage', peerID, maxID, fullLimit, angular.copy(historyStorage));
return requestHistory (inputPeer, maxID, fullLimit).then(function (historyResult) { var migratedNextPeer = migratedFromTo[peerID];
var migratedPrevPeer = migratedToFrom[peerID];
var isMigrated = migratedNextPeer !== undefined || migratedPrevPeer !== undefined;
return requestHistory (peerID, maxID, fullLimit).then(function (historyResult) {
historyStorage.count = historyResult.count || historyResult.messages.length; historyStorage.count = historyResult.count || historyResult.messages.length;
var peerID = AppPeersManager.getPeerID(inputPeer);
var migratedFromPeer = migratedTo[peerID];
// if () {
// historyStorage.count++;
// }
var offset = 0; var offset = 0;
if (!maxID && historyResult.messages.length) { if (!maxID && historyResult.messages.length) {
@ -494,22 +492,41 @@ angular.module('myApp.services')
} }
} }
var wasTotalCount = historyStorage.history.length;
historyStorage.history.splice(offset, historyStorage.history.length - offset); historyStorage.history.splice(offset, historyStorage.history.length - offset);
angular.forEach(historyResult.messages, function (message) { angular.forEach(historyResult.messages, function (message) {
if (mergeReplyKeyboard(historyStorage, message)) { if (mergeReplyKeyboard(historyStorage, message)) {
$rootScope.$broadcast('history_reply_markup', {peerID: AppPeersManager.getPeerID(inputPeer)}); $rootScope.$broadcast('history_reply_markup', {peerID: peerID});
} }
historyStorage.history.push(message.mid); historyStorage.history.push(message.mid);
}); });
fullLimit -= historyResult.messages.length; var totalCount = historyStorage.history.length;
fullLimit -= (totalCount - wasTotalCount);
if (fullLimit > 0 && if (isMigrated) {
(historyStorage.history.length < historyStorage.count || migratedFromPeer)) { historyStorage.count = Math.max(historyStorage.count, totalCount) + 1;
maxID = historyStorage.history[historyStorage.history.length - 1];
return fillHistoryStorage(inputPeer, maxID, fullLimit, historyStorage);
} }
if (fullLimit > 0) {
maxID = historyStorage.history[totalCount - 1];
if (isMigrated) {
if (!historyResult.messages.length) {
if (migratedPrevPeer) {
maxID = 0;
peerID = migratedPrevPeer;
} else {
historyStorage.count = totalCount;
return true;
}
}
return fillHistoryStorage(peerID, maxID, fullLimit, historyStorage);
}
else if (totalCount < historyStorage.count) {
return fillHistoryStorage(peerID, maxID, fullLimit, historyStorage);
}
}
return true; return true;
}); });
}; };
@ -529,9 +546,11 @@ angular.module('myApp.services')
return $q.when(result); return $q.when(result);
} }
function getHistory (inputPeer, maxID, limit, backLimit, prerendered) { function getHistory (peerID, maxID, limit, backLimit, prerendered) {
var peerID = AppPeersManager.getPeerID(inputPeer), if (migratedFromTo[peerID]) {
historyStorage = historiesStorage[peerID], peerID = migratedFromTo[peerID];
}
var historyStorage = historiesStorage[peerID],
offset = 0, offset = 0,
offsetNotFound = false, offsetNotFound = false,
unreadOffset = false, unreadOffset = false,
@ -543,6 +562,15 @@ angular.module('myApp.services')
historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []}; historyStorage = historiesStorage[peerID] = {count: null, history: [], pending: []};
} }
var isMigrated = false;
var reqPeerID = peerID;
if (migratedToFrom[peerID]) {
isMigrated = true;
if (maxID && maxID < fullMsgIDModulus) {
reqPeerID = migratedToFrom[peerID];
}
}
if (!limit && !maxID) { if (!limit && !maxID) {
var foundDialog = getDialogByPeerID(peerID)[0]; var foundDialog = getDialogByPeerID(peerID)[0];
if (foundDialog && foundDialog.unread_count > 1) { if (foundDialog && foundDialog.unread_count > 1) {
@ -611,8 +639,11 @@ angular.module('myApp.services')
offset = -backLimit; offset = -backLimit;
limit += backLimit; limit += backLimit;
} }
return requestHistory(inputPeer, maxID, limit, offset).then(function (historyResult) { return requestHistory(reqPeerID, maxID, limit, offset).then(function (historyResult) {
historyStorage.count = historyResult.count || historyResult.messages.length; historyStorage.count = historyResult.count || historyResult.messages.length;
if (isMigrated) {
historyStorage.count++;
}
var history = []; var history = [];
angular.forEach(historyResult.messages, function (message) { angular.forEach(historyResult.messages, function (message) {
@ -631,7 +662,7 @@ angular.module('myApp.services')
}) })
} }
return fillHistoryStorage(inputPeer, maxID, limit, historyStorage).then(function () { return fillHistoryStorage(peerID, maxID, limit, historyStorage).then(function () {
offset = 0; offset = 0;
if (maxID > 0) { if (maxID > 0) {
for (offset = 0; offset < historyStorage.history.length; offset++) { for (offset = 0; offset < historyStorage.history.length; offset++) {
@ -728,10 +759,9 @@ angular.module('myApp.services')
return false; return false;
} }
function getSearch (inputPeer, query, inputFilter, maxID, limit) { function getSearch (peerID, query, inputFilter, maxID, limit) {
var foundMsgs = [], var foundMsgs = [],
useSearchCache = !query, useSearchCache = !query,
peerID = AppPeersManager.getPeerID(inputPeer),
newSearchFilter = {peer: peerID, filter: inputFilter}, newSearchFilter = {peer: peerID, filter: inputFilter},
sameSearchCache = useSearchCache && angular.equals(lastSearchFilter, newSearchFilter); sameSearchCache = useSearchCache && angular.equals(lastSearchFilter, newSearchFilter);
@ -817,7 +847,7 @@ angular.module('myApp.services')
} }
apiPromise = MtpApiManager.invokeApi('messages.search', { apiPromise = MtpApiManager.invokeApi('messages.search', {
flags: flags, flags: flags,
peer: inputPeer, peer: AppPeersManager.getInputPeerByID(peerID),
q: query || '', q: query || '',
filter: inputFilter || {_: 'inputMessagesFilterEmpty'}, filter: inputFilter || {_: 'inputMessagesFilterEmpty'},
min_date: 0, min_date: 0,
@ -884,6 +914,7 @@ angular.module('myApp.services')
function deleteMessages (messageIDs) { function deleteMessages (messageIDs) {
var splitted = splitMessageIDsByChannels(messageIDs); var splitted = splitMessageIDsByChannels(messageIDs);
debugger;
var promises = []; var promises = [];
angular.forEach(splitted.msgIDs, function (msgIDs, channelID) { angular.forEach(splitted.msgIDs, function (msgIDs, channelID) {
var promise; var promise;
@ -940,10 +971,9 @@ angular.module('myApp.services')
return $q.all(promises); return $q.all(promises);
} }
function readHistory (inputPeer) { function readHistory (peerID) {
// console.trace('start read'); // console.trace('start read');
var peerID = AppPeersManager.getPeerID(inputPeer), var isChannel = AppPeersManager.isChannel(peerID),
isChannel = AppPeersManager.isChannel(peerID),
historyStorage = historiesStorage[peerID], historyStorage = historiesStorage[peerID],
foundDialog = getDialogByPeerID(peerID)[0]; foundDialog = getDialogByPeerID(peerID)[0];
@ -981,7 +1011,7 @@ angular.module('myApp.services')
}); });
} else { } else {
apiPromise = MtpApiManager.invokeApi('messages.readHistory', { apiPromise = MtpApiManager.invokeApi('messages.readHistory', {
peer: inputPeer, peer: AppPeersManager.getInputPeerByID(peerID),
max_id: 0 max_id: 0
}); });
} }
@ -1059,9 +1089,8 @@ angular.module('myApp.services')
}); });
} }
function flushHistory (inputPeer) { function flushHistory (peerID) {
var peerID = AppPeersManager.getPeerID(inputPeer); return doFlushHistory(AppPeersManager.getInputPeerByID(peerID)).then(function () {
return doFlushHistory(inputPeer).then(function () {
var foundDialog = getDialogByPeerID(peerID); var foundDialog = getDialogByPeerID(peerID);
if (foundDialog[0]) { if (foundDialog[0]) {
dialogsStorage.dialogs.splice(foundDialog[1], 1); dialogsStorage.dialogs.splice(foundDialog[1], 1);
@ -1201,7 +1230,6 @@ angular.module('myApp.services')
randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)], randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)],
randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(), randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(),
historyStorage = historiesStorage[peerID], historyStorage = historiesStorage[peerID],
inputPeer = AppPeersManager.getInputPeerByID(peerID),
flags = 0, flags = 0,
pFlags = {}, pFlags = {},
replyToMsgID = options.replyToMsgID, replyToMsgID = options.replyToMsgID,
@ -1285,7 +1313,7 @@ angular.module('myApp.services')
// console.log(flags, entities); // console.log(flags, entities);
MtpApiManager.invokeApi('messages.sendMessage', { MtpApiManager.invokeApi('messages.sendMessage', {
flags: flags, flags: flags,
peer: inputPeer, peer: AppPeersManager.getInputPeerByID(peerID),
message: text, message: text,
random_id: randomID, random_id: randomID,
reply_to_msg_id: getMessageLocalID(replyToMsgID), reply_to_msg_id: getMessageLocalID(replyToMsgID),
@ -1343,7 +1371,6 @@ angular.module('myApp.services')
randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)], randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)],
randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(), randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(),
historyStorage = historiesStorage[peerID], historyStorage = historiesStorage[peerID],
inputPeer = AppPeersManager.getInputPeerByID(peerID),
flags = 0, flags = 0,
pFlags = {}, pFlags = {},
replyToMsgID = options.replyToMsgID, replyToMsgID = options.replyToMsgID,
@ -1474,7 +1501,7 @@ angular.module('myApp.services')
} }
MtpApiManager.invokeApi('messages.sendMedia', { MtpApiManager.invokeApi('messages.sendMedia', {
flags: flags, flags: flags,
peer: inputPeer, peer: AppPeersManager.getInputPeerByID(peerID),
media: inputMedia, media: inputMedia,
random_id: randomID, random_id: randomID,
reply_to_msg_id: getMessageLocalID(replyToMsgID) reply_to_msg_id: getMessageLocalID(replyToMsgID)
@ -1532,7 +1559,6 @@ angular.module('myApp.services')
randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)], randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)],
randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(), randomIDS = bigint(randomID[0]).shiftLeft(32).add(bigint(randomID[1])).toString(),
historyStorage = historiesStorage[peerID], historyStorage = historiesStorage[peerID],
inputPeer = AppPeersManager.getInputPeerByID(peerID),
replyToMsgID = options.replyToMsgID, replyToMsgID = options.replyToMsgID,
isChannel = AppPeersManager.isChannel(peerID), isChannel = AppPeersManager.isChannel(peerID),
isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID), isMegagroup = isChannel && AppPeersManager.isMegagroup(peerID),
@ -1635,7 +1661,7 @@ angular.module('myApp.services')
MtpApiManager.invokeApi('messages.sendMedia', { MtpApiManager.invokeApi('messages.sendMedia', {
flags: flags, flags: flags,
peer: inputPeer, peer: AppPeersManager.getInputPeerByID(peerID),
media: inputMedia, media: inputMedia,
random_id: randomID, random_id: randomID,
reply_to_msg_id: getMessageLocalID(replyToMsgID) reply_to_msg_id: getMessageLocalID(replyToMsgID)
@ -2827,10 +2853,9 @@ angular.module('myApp.services')
function reloadChannelDialog (channelID) { function reloadChannelDialog (channelID) {
var peerID = -channelID; var peerID = -channelID;
var inputPeer = AppPeersManager.getInputPeerByID(peerID);
return $q.all([ return $q.all([
AppProfileManager.getChannelFull(channelID, true), AppProfileManager.getChannelFull(channelID, true),
getHistory(inputPeer, 0) getHistory(peerID, 0)
]).then(function (results) { ]).then(function (results) {
var channelResult = results[0]; var channelResult = results[0];
var historyResult = results[1]; var historyResult = results[1];

2
app/js/services.js

@ -599,7 +599,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
}; };
function getChat (id) { function getChat (id) {
return chats[id] || {id: id, deleted: true}; return chats[id] || {id: id, deleted: true, access_hash: channelAccess[id]};
} }
function hasRights (id, action) { function hasRights (id, action) {

Loading…
Cancel
Save