Skip to content

Commit

Permalink
Support t.me/username?text=.. links.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Apr 9, 2024
1 parent 170ebb5 commit a506b8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Telegram/SourceFiles/core/local_url_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
4 changes: 4 additions & 0 deletions Telegram/SourceFiles/window/window_session_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct PeerByLinkInfo {
QString chatLinkSlug;
MsgId messageId = ShowAtUnreadMsgId;
StoryId storyId = 0;
QString text;
RepliesByLinkInfo repliesInfo;
ResolveType resolveType = ResolveType::Default;
QString startToken;
Expand Down

0 comments on commit a506b8b

Please sign in to comment.