mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Fix opening links from bot inline reply markup.
This commit is contained in:
parent
5fe1988d0a
commit
b84c876ba2
2 changed files with 12 additions and 4 deletions
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
|
||||
namespace {
|
||||
|
@ -118,8 +119,12 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
|
|||
? QString::fromUtf8(parsedUrl.toEncoded())
|
||||
: ShowEncoded(displayed);
|
||||
const auto my = context.value<ClickHandlerContext>();
|
||||
if (const auto controller = my.sessionWindow.get()) {
|
||||
controller->show(
|
||||
const auto controller = my.sessionWindow.get();
|
||||
const auto use = controller
|
||||
? &controller->window()
|
||||
: Core::App().activeWindow();
|
||||
if (use) {
|
||||
use->show(
|
||||
Ui::MakeConfirmBox({
|
||||
.text = (tr::lng_open_this_link(tr::now)
|
||||
+ qsl("\n\n")
|
||||
|
|
|
@ -133,10 +133,13 @@ void activateBotCommand(
|
|||
skipConfirmation = true;
|
||||
}
|
||||
}
|
||||
const auto context = QVariant::fromValue(ClickHandlerContext{
|
||||
.sessionWindow = sessionController.get(),
|
||||
});
|
||||
if (skipConfirmation) {
|
||||
UrlClickHandler::Open(url);
|
||||
UrlClickHandler::Open(url, context);
|
||||
} else {
|
||||
HiddenUrlClickHandler::Open(url);
|
||||
HiddenUrlClickHandler::Open(url, context);
|
||||
}
|
||||
} break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue