Fixed handling post links

Closes #1095
This commit is contained in:
Igor Zhukov 2016-04-03 23:39:51 +03:00
parent 5b049aff59
commit 375379be6e
3 changed files with 17 additions and 6 deletions

View File

@ -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] : '');
}

View File

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

View File

@ -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'])
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;
}