diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 1416b6bf00..a5a147ebf8 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3559,6 +3559,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_forum_no_messages" = "No messages"; "lng_forum_messages#one" = "{count} message"; "lng_forum_messages#other" = "{count} messages"; +"lng_forum_show_topics_list" = "Show Topics List"; // Wnd specific diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index a1da2515c0..354a3630bd 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -194,6 +194,7 @@ private: object_ptr setupInfo(); object_ptr setupMuteToggle(); void setupMainButtons(); + Ui::MultiSlideTracker fillTopicButtons(); Ui::MultiSlideTracker fillUserButtons( not_null user); Ui::MultiSlideTracker fillChannelButtons( @@ -538,11 +539,15 @@ void DetailsFiller::setupMainButtons() { auto tracker = callback(); topSkip->toggleOn(std::move(tracker).atLeastOneShownValue()); }; - if (auto user = _peer->asUser()) { + if (_topic) { + wrapButtons([=] { + return fillTopicButtons(); + }); + } else if (const auto user = _peer->asUser()) { wrapButtons([=] { return fillUserButtons(user); }); - } else if (auto channel = _peer->asChannel()) { + } else if (const auto channel = _peer->asChannel()) { if (!channel->isMegagroup()) { wrapButtons([=] { return fillChannelButtons(channel); @@ -551,6 +556,26 @@ void DetailsFiller::setupMainButtons() { } } +Ui::MultiSlideTracker DetailsFiller::fillTopicButtons() { + using namespace rpl::mappers; + + Ui::MultiSlideTracker tracker; + const auto window = _controller->parentController(); + + const auto channel = _topic->channel().get(); + auto showTopicsVisible = rpl::combine( + window->adaptive().oneColumnValue(), + window->openedForum().value(), + _1 || (_2 != channel)); + AddMainButton( + _wrap, + tr::lng_forum_show_topics_list(), + std::move(showTopicsVisible), + [=] { window->openForum(channel); }, + tracker); + return tracker; +} + Ui::MultiSlideTracker DetailsFiller::fillUserButtons( not_null user) { using namespace rpl::mappers; diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 357044bae4..7c0079c2b0 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -983,7 +983,9 @@ void SessionController::openForum( if (_openedForum.current() != forum) { resetFakeUnreadWhileOpened(); } - if (forum && _activeChatEntry.current().key.peer()) { + if (forum + && _activeChatEntry.current().key.peer() + && adaptive().isOneColumn()) { clearSectionStack(params); } _openedForum = forum.get(); @@ -996,6 +998,9 @@ void SessionController::openForum( { anim::type::normal, anim::activation::background }); }, _openedForumLifetime); } + if (params.activation != anim::activation::background) { + hideLayer(); + } } void SessionController::closeForum() {