Browse Source

Fixed group to supergroup migrate issue

master
Igor Zhukov 7 years ago
parent
commit
a6fe495c07
  1. 7
      app/js/controllers.js
  2. 4
      app/js/messages_manager.js
  3. 12
      app/js/services.js

7
app/js/controllers.js

@ -1293,6 +1293,13 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -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 || '')

4
app/js/messages_manager.js

@ -1552,6 +1552,7 @@ angular.module('myApp.services') @@ -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') @@ -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') @@ -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') @@ -2126,6 +2129,7 @@ angular.module('myApp.services')
}
function forwardMessages (peerID, mids, options) {
peerID = AppPeersManager.getPeerMigratedTo(peerID) || peerID
mids = mids.sort()
options = options || {}

12
app/js/services.js

@ -1019,6 +1019,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -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']) @@ -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,

Loading…
Cancel
Save