Browse Source

Fixed handling post links

Closes #1095
master
Igor Zhukov 9 years ago
parent
commit
375379be6e
  1. 5
      app/js/lib/ng_utils.js
  2. 1
      app/js/messages_manager.js
  3. 17
      app/js/services.js

5
app/js/lib/ng_utils.js

@ -1590,7 +1590,10 @@ angular.module('izhukov.utils', []) @@ -1590,7 +1590,10 @@ angular.module('izhukov.utils', [])
url = 'tg://addstickers?set=' + path[1];
break;
default:
if (!path[1]) {
if (path[1] && path[1].match(/^\d+$/)) {
url = 'tg://resolve?domain=' + path[0] + '&post=' + path[1];
}
else if (!path[1]) {
var domainQuery = path[0].split('?');
url = 'tg://resolve?domain=' + domainQuery[0] + (domainQuery[1] ? '&' + domainQuery[1] : '');
}

1
app/js/messages_manager.js

@ -3077,6 +3077,7 @@ angular.module('myApp.services') @@ -3077,6 +3077,7 @@ angular.module('myApp.services')
openChatInviteLink: openChatInviteLink,
convertMigratedPeer: convertMigratedPeer,
getMessagePeer: getMessagePeer,
getFullMessageID: getFullMessageID,
getMessageThumb: getMessageThumb,
clearDialogCache: clearDialogCache,
wrapForDialog: wrapForDialog,

17
app/js/services.js

@ -4231,7 +4231,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4231,7 +4231,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
function handleTgProtoAddr (url, inner) {
var matches;
if (matches = url.match(/^resolve\?domain=(.+?)(?:&(start|startgroup)=(.+))?$/)) {
if (matches = url.match(/^resolve\?domain=(.+?)(?:&(start|startgroup|post)=(.+))?$/)) {
AppPeersManager.resolveUsername(matches[1]).then(function (peerID) {
if (peerID > 0 && AppUsersManager.isBot(peerID) && matches[2] == 'startgroup') {
@ -4248,10 +4248,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) @@ -4248,10 +4248,17 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
return true;
}
$rootScope.$broadcast('history_focus', {
peerString: AppPeersManager.getPeerString(peerID),
startParam: matches[3]
});
var params = {
peerString: AppPeersManager.getPeerString(peerID)
};
if (matches[2] == 'start') {
params.startParam = matches[3];
} else {
params.messageID = AppMessagesManager.getFullMessageID(parseInt(matches[3]), -peerID);
}
$rootScope.$broadcast('history_focus', params);
});
return true;
}

Loading…
Cancel
Save