diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index c6cb70434..a098faeb6 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -507,6 +507,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 d1b939041..0106a721a 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -291,6 +291,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 d7bba8094..bf0c39280 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -69,6 +69,8 @@ QString IDString(not_null peer); not_null user); [[nodiscard]] rpl::producer CanAddContactValue( not_null user); +[[nodiscard]] rpl::producer HasLinkedChatValue( + not_null channel); [[nodiscard]] rpl::producer AmInChannelValue( not_null channel); [[nodiscard]] rpl::producer MembersCountValue(not_null peer);