diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index a2c84c3e3..2eed3e508 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1483,6 +1483,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_topic_renamed" = "{from} renamed the {link} to «{title}»"; "lng_action_topic_icon_changed" = "{from} changed the {link} icon to {emoji}"; "lng_action_topic_icon_removed" = "{from} removed the {link} icon"; +"lng_action_shared_chat_with_bot" = "You shared {chat} with {bot}"; "lng_premium_gift_duration_months#one" = "for {count} month"; "lng_premium_gift_duration_months#other" = "for {count} months"; @@ -3554,6 +3555,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_request_peer_requirements" = "Requirements"; "lng_request_peer_rights" = "You should have the admin rights to {rights}."; "lng_request_peer_rights_and" = "{rights} and {last}"; +"lng_request_peer_confirm" = "Are you sure you want to send {chat} to {bot}?"; +"lng_request_peer_confirm_add" = "This will also add {bot} to {chat}."; +"lng_request_peer_confirm_rights" = "This will also add {bot} to {chat} with the following rights: {rights}."; +"lng_request_peer_confirm_send" = "Send"; "lng_request_user_title" = "Choose User"; "lng_request_user_premium_yes" = "The user should have a Premium subscription."; "lng_request_user_premium_no" = "The user shouldn't have a Premium subscription."; diff --git a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp index 063e3f4c7..1a2f8fe30 100644 --- a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp @@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "info/profile/info_profile_icon.h" #include "lang/lang_keys.h" #include "settings/settings_common.h" +#include "ui/boxes/confirm_box.h" #include "ui/widgets/buttons.h" #include "ui/wrap/vertical_layout.h" #include "window/window_session_controller.h" @@ -169,6 +170,19 @@ private: return result; } +object_ptr MakeConfirmBox( + not_null bot, + not_null peer, + RequestPeerQuery query, + Fn confirmed) { + auto text = TextWithEntities{ "Sure?.." }; + return Ui::MakeConfirmBox({ + .text = std::move(text), + .confirmed = std::move(confirmed), + .confirmText = tr::lng_request_peer_confirm_send(tr::now), + }); +} + object_ptr CreatePeerByQueryBox( not_null navigation, not_null bot, @@ -334,8 +348,12 @@ void ChoosePeerBoxController::prepareViewHook() { } void ChoosePeerBoxController::rowClicked(not_null row) { - const auto onstack = _callback; - onstack(row->peer()); + const auto peer = row->peer(); + const auto done = [callback = _callback, peer] { + const auto onstack = callback; + onstack(peer); + }; + delegate()->peerListShowBox(MakeConfirmBox(_bot, peer, _query, done)); } auto ChoosePeerBoxController::createRow(not_null history) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 388f14d14..28b921fbe 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -4130,12 +4130,15 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { const auto peerId = peerFromMTP(action.vpeer()); const auto peer = history()->owner().peer(peerId); auto result = PreparedServiceText{}; - result.text = TextWithEntities{ - u"You chose "_q - }.append( - Ui::Text::Link(peer->name(), 1) - ).append(u" for the bot."_q); + result.text = tr::lng_action_shared_chat_with_bot( + tr::now, + lt_chat, + Ui::Text::Link(peer->name(), 1), + lt_bot, + Ui::Text::Link(history()->peer->name(), 2), + Ui::Text::WithEntities); result.links.push_back(peer->createOpenLink()); + result.links.push_back(history()->peer->createOpenLink()); return result; };