From 9a72b0511758e1a7e7706cf6be43a5191f3c2842 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 24 Jul 2023 22:15:51 +0300 Subject: [PATCH] Removed left button from short info box with self. --- .../boxes/peers/peer_short_info_box.cpp | 16 ++++++++++------ .../boxes/peers/peer_short_info_box.h | 1 + .../boxes/peers/prepare_short_info_box.cpp | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp index 5d8e93901..bc07210f6 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp @@ -685,12 +685,16 @@ rpl::producer PeerShortInfoBox::moveRequests() const { void PeerShortInfoBox::prepare() { addButton(tr::lng_close(), [=] { closeBox(); }); - // Perhaps a new lang key should be added for opening a group. - addLeftButton((_type == PeerShortInfoType::User) - ? tr::lng_profile_send_message() - : (_type == PeerShortInfoType::Group) - ? tr::lng_view_button_group() - : tr::lng_profile_view_channel(), [=] { _openRequests.fire({}); }); + if (_type != PeerShortInfoType::Self) { + // Perhaps a new lang key should be added for opening a group. + addLeftButton( + (_type == PeerShortInfoType::User) + ? tr::lng_profile_send_message() + : (_type == PeerShortInfoType::Group) + ? tr::lng_view_button_group() + : tr::lng_profile_view_channel(), + [=] { _openRequests.fire({}); }); + } prepareRows(); diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h index 0e130562d..bf59ff7aa 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.h @@ -28,6 +28,7 @@ class RpWidget; } // namespace Ui enum class PeerShortInfoType { + Self, User, Group, Channel, diff --git a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp index dfe8bdf72..d71645316 100644 --- a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp @@ -431,7 +431,9 @@ object_ptr PrepareShortInfoBox( Fn open, Fn videoPaused, const style::ShortInfoBox *stOverride) { - const auto type = peer->isUser() + const auto type = peer->isSelf() + ? PeerShortInfoType::Self + : peer->isUser() ? PeerShortInfoType::User : peer->isBroadcast() ? PeerShortInfoType::Channel