Fix read from clipboard after bot install.

This commit is contained in:
John Preston 2023-01-12 12:18:25 +04:00
parent 5cba1cdc64
commit 732bb25666
2 changed files with 5 additions and 5 deletions

View file

@ -497,7 +497,7 @@ void AttachWebView::request(const WebViewButton &button) {
data.vquery_id().v,
qs(data.vurl()),
button.text,
button.fromMenu);
button.fromMenu || button.url.isEmpty());
});
}).fail([=](const MTP::Error &error) {
_requestId = 0;
@ -742,7 +742,7 @@ void AttachWebView::requestMenu(
_action->history->peer->input,
_bot->inputUser,
MTP_string(url),
MTPstring(), // url
MTPstring(), // start_param
MTP_dataJSON(MTP_bytes(Window::Theme::WebViewParams().json)),
MTP_string("tdesktop"),
MTP_int(_action->replyTo.bare),
@ -800,7 +800,7 @@ void AttachWebView::show(
uint64 queryId,
const QString &url,
const QString &buttonText,
bool fromMenu) {
bool allowClipboardRead) {
Expects(_bot != nullptr && _action.has_value());
const auto close = crl::guard(this, [=] {
@ -924,7 +924,7 @@ void AttachWebView::show(
.menuButtons = buttons,
.handleMenuButton = handleMenuButton,
.themeParams = [] { return Window::Theme::WebViewParams(); },
.allowClipboardRead = fromMenu,
.allowClipboardRead = allowClipboardRead,
});
*panel = _panel.get();
started(queryId);

View file

@ -135,7 +135,7 @@ private:
uint64 queryId,
const QString &url,
const QString &buttonText = QString(),
bool fromMenu = false);
bool allowClipboardRead = false);
void confirmAddToMenu(
AttachWebViewBot bot,
Fn<void()> callback = nullptr);