diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 0d44901dd..c3481b266 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -1325,6 +1325,21 @@ object_ptr DetailsFiller::setupInfo() { if (!_topic) { addTranslateToMenu(about.text, AboutWithIdValue(_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 d2efb4f18..1d8e1c64c 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -413,6 +413,13 @@ rpl::producer PersonalChannelValue(not_null user) { }); } +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 7a4c43fbc..0da8ed7ed 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -101,6 +101,8 @@ struct LinkWithUrl { not_null user); [[nodiscard]] rpl::producer PersonalChannelValue( not_null user); +[[nodiscard]] rpl::producer HasLinkedChatValue( + not_null channel); [[nodiscard]] rpl::producer AmInChannelValue( not_null channel); [[nodiscard]] rpl::producer MembersCountValue(not_null peer);