diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 7f76e19cda..0cc0ff3fc1 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -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; } diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 3a69f7b057..cf3d618ccd 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -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); + } }); } } diff --git a/Telegram/SourceFiles/window/window_session_controller_link_info.h b/Telegram/SourceFiles/window/window_session_controller_link_info.h index bf6ecc2be7..7608a07b9c 100644 --- a/Telegram/SourceFiles/window/window_session_controller_link_info.h +++ b/Telegram/SourceFiles/window/window_session_controller_link_info.h @@ -62,6 +62,7 @@ struct PeerByLinkInfo { std::optional voicechatHash; FullMsgId clickFromMessageId; std::shared_ptr clickFromBotWebviewContext; + bool historyInNewWindow = false; }; } // namespace Window