Browse Source

Fixed jump to legacy chat from search results

master
Igor Zhukov 9 years ago
parent
commit
64a34fc67e
  1. 7
      app/js/controllers.js
  2. 14
      app/js/messages_manager.js

7
app/js/controllers.js

@ -412,7 +412,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
LayoutSwitchService.start(); LayoutSwitchService.start();
}) })
.controller('AppIMController', function ($q, qSync, $scope, $location, $routeParams, $modal, $rootScope, $modalStack, MtpApiManager, AppUsersManager, AppChatsManager, AppPeersManager, ContactsSelectService, ChangelogNotifyService, ErrorService, AppRuntimeManager, HttpsMigrateService, LayoutSwitchService, LocationParamsService, AppStickersManager) { .controller('AppIMController', function ($q, qSync, $scope, $location, $routeParams, $modal, $rootScope, $modalStack, MtpApiManager, AppUsersManager, AppChatsManager, AppMessagesManager, AppPeersManager, ContactsSelectService, ChangelogNotifyService, ErrorService, AppRuntimeManager, HttpsMigrateService, LayoutSwitchService, LocationParamsService, AppStickersManager) {
$scope.$on('$routeUpdate', updateCurDialog); $scope.$on('$routeUpdate', updateCurDialog);
@ -546,6 +546,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
else if ($scope.search.query) { else if ($scope.search.query) {
$scope.searchClear(); $scope.searchClear();
} }
var peerID = AppPeersManager.getPeerID(peerString);
var converted = AppMessagesManager.convertMigratedPeer(peerID);
if (converted) {
params.peerString = AppPeersManager.getPeerString(converted);
}
$rootScope.$broadcast('history_focus', params); $rootScope.$broadcast('history_focus', params);
}; };

14
app/js/messages_manager.js

@ -571,6 +571,12 @@ angular.module('myApp.services')
} }
} }
function convertMigratedPeer (peerID) {
if (migratedFromTo[peerID]) {
return migratedFromTo[peerID];
}
}
function getHistory (peerID, maxID, limit, backLimit, prerendered) { function getHistory (peerID, maxID, limit, backLimit, prerendered) {
if (migratedFromTo[peerID]) { if (migratedFromTo[peerID]) {
peerID = migratedFromTo[peerID]; peerID = migratedFromTo[peerID];
@ -915,6 +921,13 @@ angular.module('myApp.services')
foundMsgs = []; foundMsgs = [];
angular.forEach(searchResult.messages, function (message) { angular.forEach(searchResult.messages, function (message) {
var peerID = getMessagePeer(message);
if (peerID < 0) {
var chat = AppChatsManager.getChat(-peerID);
if (chat.migrated_to) {
migrateChecks(peerID, -chat.migrated_to.channel_id);
}
}
foundMsgs.push(message.mid); foundMsgs.push(message.mid);
}); });
@ -2952,6 +2965,7 @@ angular.module('myApp.services')
forwardMessages: forwardMessages, forwardMessages: forwardMessages,
startBot: startBot, startBot: startBot,
openChatInviteLink: openChatInviteLink, openChatInviteLink: openChatInviteLink,
convertMigratedPeer: convertMigratedPeer,
getMessagePeer: getMessagePeer, getMessagePeer: getMessagePeer,
getMessageThumb: getMessageThumb, getMessageThumb: getMessageThumb,
wrapForDialog: wrapForDialog, wrapForDialog: wrapForDialog,

Loading…
Cancel
Save