diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 6c82a67a4..774147b54 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -354,6 +354,21 @@ object_ptr DetailsFiller::setupInfo() { } addInfoLine(tr::lng_info_about_label(), AboutValue(_peer)); + + if (const auto channel = _peer->asChannel()) { + const auto controller = _controller->parentController(); + auto viewLinkedGroup = [=] { + controller->showPeerHistory( + channel->linkedChat(), + Window::SectionShow::Way::Forward); + }; + AddMainButton( + result, + (channel->isBroadcast() ? tr::lng_channel_discuss() : tr::lng_manage_linked_channel()), + HasLinkedChatValue(channel), + std::move(viewLinkedGroup), + tracker); + } } if (!_peer->isSelf()) { // No notifications toggle for Self => no separator. diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index fddbf6097..b52585468 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -198,6 +198,13 @@ rpl::producer CanAddContactValue(not_null user) { ) | rpl::map(!_1); } +rpl::producer HasLinkedChatValue(not_null channel) { + return Notify::PeerUpdateValue( + channel, + Notify::PeerUpdate::Flag::ChannelLinkedChat + ) | rpl::map([channel] { return channel->linkedChat() != nullptr; }); +} + rpl::producer AmInChannelValue(not_null channel) { return Notify::PeerUpdateValue( channel, diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.h b/Telegram/SourceFiles/info/profile/info_profile_values.h index 711ebb6e0..9f60604a5 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -50,6 +50,7 @@ rpl::producer IsContactValue(not_null user); rpl::producer CanInviteBotToGroupValue(not_null user); rpl::producer CanShareContactValue(not_null user); rpl::producer CanAddContactValue(not_null user); +rpl::producer HasLinkedChatValue(not_null channel); rpl::producer AmInChannelValue(not_null channel); rpl::producer MembersCountValue(not_null peer); rpl::producer AdminsCountValue(not_null peer);