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]; url = 'tg://addstickers?set=' + path[1];
break; break;
default: 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('?'); var domainQuery = path[0].split('?');
url = 'tg://resolve?domain=' + domainQuery[0] + (domainQuery[1] ? '&' + domainQuery[1] : ''); url = 'tg://resolve?domain=' + domainQuery[0] + (domainQuery[1] ? '&' + domainQuery[1] : '');
} }

View File

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

View File

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