Fixed opening of local links from webview bots in appropriate window.

This commit is contained in:
23rd 2024-03-05 17:09:25 +03:00 committed by John Preston
parent a704611705
commit ef474f0dc8
1 changed files with 8 additions and 1 deletions

View File

@ -566,9 +566,16 @@ bool AttachWebView::botHandleLocalUri(QString uri, bool keepOpen) {
if (!keepOpen) { if (!keepOpen) {
botClose(); botClose();
} }
crl::on_main([=, shownUrl = _lastShownUrl] { crl::on_main([=, shownUrl = _lastShownUrl, bot = _bot] {
if (bot->session().windows().empty()) {
Core::App().domain().activate(&bot->session().account());
}
const auto window = !bot->session().windows().empty()
? bot->session().windows().front()
: nullptr;
const auto variant = QVariant::fromValue(ClickHandlerContext{ const auto variant = QVariant::fromValue(ClickHandlerContext{
.attachBotWebviewUrl = shownUrl, .attachBotWebviewUrl = shownUrl,
.sessionWindow = window,
}); });
UrlClickHandler::Open(local, variant); UrlClickHandler::Open(local, variant);
}); });