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']) @@ -412,7 +412,7 @@ angular.module('myApp.controllers', ['myApp.i18n'])
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);
@ -546,6 +546,11 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -546,6 +546,11 @@ angular.module('myApp.controllers', ['myApp.i18n'])
else if ($scope.search.query) {
$scope.searchClear();
}
var peerID = AppPeersManager.getPeerID(peerString);
var converted = AppMessagesManager.convertMigratedPeer(peerID);
if (converted) {
params.peerString = AppPeersManager.getPeerString(converted);
}
$rootScope.$broadcast('history_focus', params);
};

14
app/js/messages_manager.js

@ -571,6 +571,12 @@ angular.module('myApp.services') @@ -571,6 +571,12 @@ angular.module('myApp.services')
}
}
function convertMigratedPeer (peerID) {
if (migratedFromTo[peerID]) {
return migratedFromTo[peerID];
}
}
function getHistory (peerID, maxID, limit, backLimit, prerendered) {
if (migratedFromTo[peerID]) {
peerID = migratedFromTo[peerID];
@ -915,6 +921,13 @@ angular.module('myApp.services') @@ -915,6 +921,13 @@ angular.module('myApp.services')
foundMsgs = [];
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);
});
@ -2952,6 +2965,7 @@ angular.module('myApp.services') @@ -2952,6 +2965,7 @@ angular.module('myApp.services')
forwardMessages: forwardMessages,
startBot: startBot,
openChatInviteLink: openChatInviteLink,
convertMigratedPeer: convertMigratedPeer,
getMessagePeer: getMessagePeer,
getMessageThumb: getMessageThumb,
wrapForDialog: wrapForDialog,

Loading…
Cancel
Save