2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-29 05:29:23 +00:00

Added special param to links for peers to resolve them in new window.

This commit is contained in:
23rd 2025-07-25 11:44:17 +03:00 committed by John Preston
parent 507bcbd332
commit 9d36d7119b
3 changed files with 18 additions and 1 deletions

View File

@ -708,6 +708,8 @@ bool ResolveUsernameOrPhone(
: std::nullopt), : std::nullopt),
.clickFromMessageId = myContext.itemId, .clickFromMessageId = myContext.itemId,
.clickFromBotWebviewContext = myContext.botWebviewContext, .clickFromBotWebviewContext = myContext.botWebviewContext,
.historyInNewWindow =
(params.value(u"tdesktop_target"_q) == u"blank"_q),
}); });
return true; return true;
} }

View File

@ -781,12 +781,26 @@ void SessionNavigation::showPeerByLinkResolved(
}); });
} else { } else {
const auto draft = info.text; const auto draft = info.text;
const auto historyInNewWindow = info.historyInNewWindow;
params.videoTimestamp = info.videoTimestamp; params.videoTimestamp = info.videoTimestamp;
crl::on_main(this, [=] { crl::on_main(this, [=] {
if (peer->isUser() && !draft.isEmpty()) { if (peer->isUser() && !draft.isEmpty()) {
Data::SetChatLinkDraft(peer, { draft }); Data::SetChatLinkDraft(peer, { draft });
} }
if (historyInNewWindow) {
const auto window
= Core::App().ensureSeparateWindowFor(peer);
const auto controller = window
? window->sessionController()
: nullptr;
if (controller) {
controller->showPeerHistory(peer, params, msgId);
} else {
showPeerHistory(peer, params, msgId); showPeerHistory(peer, params, msgId);
}
} else {
showPeerHistory(peer, params, msgId);
}
}); });
} }
} }

View File

@ -62,6 +62,7 @@ struct PeerByLinkInfo {
std::optional<QString> voicechatHash; std::optional<QString> voicechatHash;
FullMsgId clickFromMessageId; FullMsgId clickFromMessageId;
std::shared_ptr<InlineBots::WebViewContext> clickFromBotWebviewContext; std::shared_ptr<InlineBots::WebViewContext> clickFromBotWebviewContext;
bool historyInNewWindow = false;
}; };
} // namespace Window } // namespace Window