diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index bbd3655fe..ce5cf0d34 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -479,6 +479,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() && !::Kotato::JsonSettings::GetBool("profile_top_mute")) { // 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 dfc28d1be..011fa5901 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -249,6 +249,13 @@ rpl::producer CanAddContactValue(not_null user) { ) | rpl::map(!_1); } +rpl::producer HasLinkedChatValue(not_null channel) { + return channel->session().changes().peerFlagsValue( + channel, + UpdateFlag::ChannelLinkedChat + ) | rpl::map([channel] { return channel->linkedChat() != nullptr; }); +} + rpl::producer AmInChannelValue(not_null channel) { return channel->session().changes().peerFlagsValue( channel, diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.h b/Telegram/SourceFiles/info/profile/info_profile_values.h index a82ca18a7..210a95a66 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -57,6 +57,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 PendingRequestsCountValue(not_null peer);