diff --git a/Telegram/SourceFiles/core/click_handler_types.h b/Telegram/SourceFiles/core/click_handler_types.h index 73154ecc7..b4d352325 100644 --- a/Telegram/SourceFiles/core/click_handler_types.h +++ b/Telegram/SourceFiles/core/click_handler_types.h @@ -36,6 +36,7 @@ struct ClickHandlerContext { Fn elementDelegate; base::weak_ptr sessionWindow; bool skipBotAutoLogin = false; + bool botStartAutoSubmit = false; // Is filled from peer info. PeerData *peer = nullptr; }; diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 3e0a40f2b..f4efc6d0b 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -366,7 +366,7 @@ bool ResolveUsernameOrPhone( startToken = gameParam; resolveType = ResolveType::ShareGame; } - const auto fromMessageId = context.value().itemId; + const auto myContext = context.value(); using Navigation = Window::SessionNavigation; controller->showPeerByLink(Navigation::PeerByLinkInfo{ .usernameOrId = domain, @@ -384,6 +384,7 @@ bool ResolveUsernameOrPhone( .resolveType = resolveType, .startToken = startToken, .startAdminRights = adminRights, + .startAutoSubmit = myContext.botStartAutoSubmit, .attachBotUsername = params.value(u"attach"_q), .attachBotToggleCommand = (params.contains(u"startattach"_q) ? params.value(u"startattach"_q) @@ -397,7 +398,7 @@ bool ResolveUsernameOrPhone( : params.contains(u"voicechat"_q) ? std::make_optional(params.value(u"voicechat"_q)) : std::nullopt), - .clickFromMessageId = fromMessageId, + .clickFromMessageId = myContext.itemId, }); controller->window().activate(); return true; diff --git a/Telegram/SourceFiles/settings/settings_premium.cpp b/Telegram/SourceFiles/settings/settings_premium.cpp index a559e2234..0f5a3d29a 100644 --- a/Telegram/SourceFiles/settings/settings_premium.cpp +++ b/Telegram/SourceFiles/settings/settings_premium.cpp @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/random.h" #include "core/application.h" +#include "core/click_handler_types.h" #include "data/data_peer_values.h" #include "info/info_wrap_widget.h" // Info::Wrap. #include "info/settings/info_settings_widget.h" // SectionCustomTopBarData. @@ -926,6 +927,20 @@ QPointer Premium::createPinnedToBottom( button->resizeToWidth(width - padding.left() - padding.right()); }, status->lifetime()); + const auto controller = _controller; + status->entity()->setClickHandlerFilter([=]( + const ClickHandlerPtr &handler, + Qt::MouseButton button) { + ActivateClickHandler(status, handler, { + button, + QVariant::fromValue(ClickHandlerContext{ + .sessionWindow = base::make_weak(controller.get()), + .botStartAutoSubmit = true, + }) + }); + return false; + }); + const auto session = &_controller->session(); rpl::combine( terms->heightValue(),