From 9e79b59cce63d65916c955a94bda919f6eca25ac Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 8 Mar 2023 15:48:49 +0400 Subject: [PATCH] Remove confirmation when sharing a user to a bot. --- Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp index 078ff75171..91ce22ef89 100644 --- a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp @@ -204,8 +204,7 @@ object_ptr MakeConfirmBox( not_null peer, RequestPeerQuery query, Fn confirmed) { - const auto user = peer->asUser(); - const auto name = user ? user->firstName : peer->name(); + const auto name = peer->name(); const auto botName = bot->name(); auto text = tr::lng_request_peer_confirm( tr::now, @@ -214,7 +213,7 @@ object_ptr MakeConfirmBox( lt_bot, Ui::Text::Bold(botName), Ui::Text::WithEntities); - if (!user) { + if (!peer->isUser()) { const auto rights = peer->isBroadcast() ? BroadcastRightsText(query.botRights) : GroupRightsText(query.botRights); @@ -431,7 +430,12 @@ void ChoosePeerBoxController::rowClicked(not_null row) { const auto onstack = callback; onstack(peer); }; - delegate()->peerListShowBox(MakeConfirmBox(_bot, peer, _query, done)); + if (const auto user = peer->asUser()) { + done(); + } else { + delegate()->peerListShowBox( + MakeConfirmBox(_bot, peer, _query, done)); + } } auto ChoosePeerBoxController::createRow(not_null history)