Fixed group to supergroup migrate issue

This commit is contained in:
Igor Zhukov 2018-02-08 00:02:52 +04:00
parent de16c0c795
commit a6fe495c07
3 changed files with 26 additions and 3 deletions

View File

@ -1293,6 +1293,13 @@ angular.module('myApp.controllers', ['myApp.i18n'])
function applyDialogSelect (newDialog, oldDialog) {
peerID = $rootScope.selectedPeerID = newDialog.peerID
var migratedToPeer = AppPeersManager.getPeerMigratedTo(peerID)
if (migratedToPeer) {
$rootScope.$broadcast('history_focus', {
peerString: AppPeersManager.getPeerString(migratedToPeer)
})
return
}
$scope.historyFilter.mediaType = false
AppPeersManager.getInputPeer(newDialog.peer || $scope.curDialog.peer || '')

View File

@ -1527,9 +1527,9 @@ angular.module('myApp.services')
}
if (migrateFrom &&
migrateTo &&
!migratedFromTo[migrateFrom] &&
!migratedToFrom[migrateTo]) {
migrateTo &&
!migratedFromTo[migrateFrom] &&
!migratedToFrom[migrateTo]) {
migrateChecks(migrateFrom, migrateTo)
}
}
@ -1552,6 +1552,7 @@ angular.module('myApp.services')
if (!angular.isString(text)) {
return
}
peerID = AppPeersManager.getPeerMigratedTo(peerID) || peerID
options = options || {}
var entities = options.entities || []
if (!options.viaBotID) {
@ -1740,6 +1741,7 @@ angular.module('myApp.services')
}
function sendFile (peerID, file, options) {
peerID = AppPeersManager.getPeerMigratedTo(peerID) || peerID
options = options || {}
var messageID = tempID--
var randomID = [nextRandomInt(0xFFFFFFFF), nextRandomInt(0xFFFFFFFF)]
@ -1924,6 +1926,7 @@ angular.module('myApp.services')
}
function sendOther (peerID, inputMedia, options) {
peerID = AppPeersManager.getPeerMigratedTo(peerID) || peerID
options = options || {}
var messageID = tempID--
@ -2126,6 +2129,7 @@ angular.module('myApp.services')
}
function forwardMessages (peerID, mids, options) {
peerID = AppPeersManager.getPeerMigratedTo(peerID) || peerID
mids = mids.sort()
options = options || {}

View File

@ -1019,6 +1019,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
: AppChatsManager.getChatPhoto(-peerID)
}
function getPeerMigratedTo(peerID) {
if (peerID >= 0) {
return false
}
var chat = AppChatsManager.getChat(-peerID)
if (chat && chat.migrated_to && chat.pFlags.deactivated) {
return getPeerID(chat.migrated_to)
}
return false
}
function isChannel (peerID) {
return (peerID < 0) && AppChatsManager.isChannel(-peerID)
}
@ -1048,6 +1059,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
getPeerID: getPeerID,
getPeer: getPeer,
getPeerPhoto: getPeerPhoto,
getPeerMigratedTo: getPeerMigratedTo,
resolveUsername: resolveUsername,
isChannel: isChannel,
isAnyGroup: isAnyGroup,