Support t.me/username?text=.. links.

This commit is contained in:
John Preston 2024-04-09 14:00:48 +04:00
parent 170ebb57c6
commit a506b8b25c
3 changed files with 6 additions and 0 deletions

View File

@ -563,6 +563,7 @@ bool ResolveUsernameOrPhone(
.phone = phone,
.messageId = post,
.storyId = storyId,
.text = params.value(u"text"_q),
.repliesInfo = commentId
? Window::RepliesByLinkInfo{
Window::CommentId{ commentId }

View File

@ -702,7 +702,11 @@ void SessionNavigation::showPeerByLinkResolved(
contextUser->owner().history(contextUser))
: std::optional<Api::SendAction>()));
} else {
const auto draft = info.text;
crl::on_main(this, [=] {
if (peer->isUser() && !draft.isEmpty()) {
Data::SetChatLinkDraft(peer, { draft });
}
showPeerHistory(peer, params, msgId);
});
}

View File

@ -34,6 +34,7 @@ struct PeerByLinkInfo {
QString chatLinkSlug;
MsgId messageId = ShowAtUnreadMsgId;
StoryId storyId = 0;
QString text;
RepliesByLinkInfo repliesInfo;
ResolveType resolveType = ResolveType::Default;
QString startToken;