Open stories by t.me/username?story=id links.

This commit is contained in:
John Preston 2023-06-12 21:06:28 +04:00
parent a933168ef7
commit d7186e68e2
3 changed files with 15 additions and 0 deletions

View File

@ -383,6 +383,7 @@ bool ResolveUsernameOrPhone(
if (const auto postId = postParam.toInt()) {
post = postId;
}
const auto storyId = params.value(u"story"_q).toInt();
const auto appname = params.value(u"appname"_q);
const auto appstart = params.value(u"startapp"_q);
const auto commentParam = params.value(u"comment"_q);
@ -408,6 +409,7 @@ bool ResolveUsernameOrPhone(
.usernameOrId = domain,
.phone = phone,
.messageId = post,
.storyId = storyId,
.repliesInfo = commentId
? Navigation::RepliesByLinkInfo{
Navigation::CommentId{ commentId }

View File

@ -503,6 +503,18 @@ void SessionNavigation::showPeerByLinkResolved(
info.messageId,
callback);
}
} else if (peer->isUser() && info.storyId) {
const auto storyId = FullStoryId{ peer->id, info.storyId };
peer->owner().stories().resolve(storyId, crl::guard(this, [=] {
if (peer->owner().stories().lookup(storyId)) {
parentController()->openPeerStory(
peer,
storyId.story,
Data::StoriesContext{ Data::StoriesContextSingle() });
} else {
showToast(tr::lng_confirm_phone_link_invalid(tr::now));
}
}));
} else if (bot && resolveType == ResolveType::BotApp) {
const auto itemId = info.clickFromMessageId;
const auto item = _session->data().message(itemId);

View File

@ -204,6 +204,7 @@ public:
std::variant<QString, ChannelId> usernameOrId;
QString phone;
MsgId messageId = ShowAtUnreadMsgId;
StoryId storyId = 0;
RepliesByLinkInfo repliesInfo;
ResolveType resolveType = ResolveType::Default;
QString startToken;