2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 02:07:24 +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),
.clickFromMessageId = myContext.itemId,
.clickFromBotWebviewContext = myContext.botWebviewContext,
.historyInNewWindow =
(params.value(u"tdesktop_target"_q) == u"blank"_q),
});
return true;
}

View File

@ -781,12 +781,26 @@ void SessionNavigation::showPeerByLinkResolved(
});
} else {
const auto draft = info.text;
const auto historyInNewWindow = info.historyInNewWindow;
params.videoTimestamp = info.videoTimestamp;
crl::on_main(this, [=] {
if (peer->isUser() && !draft.isEmpty()) {
Data::SetChatLinkDraft(peer, { draft });
}
showPeerHistory(peer, params, msgId);
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);
}
} else {
showPeerHistory(peer, params, msgId);
}
});
}
}

View File

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