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:
parent
507bcbd332
commit
9d36d7119b
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ struct PeerByLinkInfo {
|
||||
std::optional<QString> voicechatHash;
|
||||
FullMsgId clickFromMessageId;
|
||||
std::shared_ptr<InlineBots::WebViewContext> clickFromBotWebviewContext;
|
||||
bool historyInNewWindow = false;
|
||||
};
|
||||
|
||||
} // namespace Window
|
||||
|
Loading…
x
Reference in New Issue
Block a user