[Improvement] Query parameter for tg://resolve links
This commit is contained in:
parent
a3791e5e31
commit
19eba9a676
2 changed files with 29 additions and 0 deletions
|
|
@ -271,6 +271,12 @@ bool ResolveUsername(
|
|||
if (domain == qsl("telegrampassport")) {
|
||||
return ShowPassportForm(controller, params);
|
||||
} else if (!valid(domain)) {
|
||||
const auto searchParam = params.value(qsl("query"));
|
||||
if (!searchParam.isEmpty()) {
|
||||
controller->content()->searchMessages(
|
||||
searchParam + ' ',
|
||||
Dialogs::Key());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
auto start = qsl("start");
|
||||
|
|
@ -321,6 +327,7 @@ bool ResolveUsername(
|
|||
? std::make_optional(params.value(u"voicechat"_q))
|
||||
: std::nullopt),
|
||||
.clickFromMessageId = fromMessageId,
|
||||
.searchQuery = params.value(qsl("query")),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -361,6 +361,7 @@ void SessionNavigation::showPeerByLinkResolved(
|
|||
return;
|
||||
}
|
||||
const auto &replies = info.repliesInfo;
|
||||
const auto searchQuery = info.searchQuery;
|
||||
if (const auto threadId = std::get_if<ThreadId>(&replies)) {
|
||||
showRepliesForMessage(
|
||||
session().data().history(peer),
|
||||
|
|
@ -395,9 +396,23 @@ void SessionNavigation::showPeerByLinkResolved(
|
|||
// Always open bot chats, even from mention links.
|
||||
crl::on_main(this, [=] {
|
||||
showPeerHistory(peer->id, params);
|
||||
if (!searchQuery.isEmpty()) {
|
||||
parentController()->content()->searchMessages(
|
||||
searchQuery + ' ',
|
||||
(peer && !peer->isUser())
|
||||
? peer->owner().history(peer).get()
|
||||
: Dialogs::Key());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showPeerInfo(peer, params);
|
||||
if (!searchQuery.isEmpty()) {
|
||||
parentController()->content()->searchMessages(
|
||||
searchQuery + ' ',
|
||||
(peer && !peer->isUser())
|
||||
? peer->owner().history(peer).get()
|
||||
: Dialogs::Key());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const auto user = peer->asUser();
|
||||
|
|
@ -414,6 +429,13 @@ void SessionNavigation::showPeerByLinkResolved(
|
|||
}
|
||||
crl::on_main(this, [=] {
|
||||
showPeerHistory(peer->id, params, msgId);
|
||||
if (!searchQuery.isEmpty()) {
|
||||
parentController()->content()->searchMessages(
|
||||
searchQuery + ' ',
|
||||
(peer && !peer->isUser())
|
||||
? peer->owner().history(peer).get()
|
||||
: Dialogs::Key());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue