diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index 8f8075bd5d..ca6b6780cb 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -273,8 +273,11 @@ infoProfileStatusLabel: FlatLabel(defaultFlatLabel) { linkFont: normalFont; linkFontOver: normalFont; } +} +infoProfileMegagroupStatusLabel: FlatLabel(infoProfileStatusLabel) { + style: defaultTextStyle; palette: TextPalette(defaultTextPalette) { - linkFg: windowActiveTextFg; + linkFg: windowSubTextFg; } } diff --git a/Telegram/SourceFiles/info/info_top_bar.cpp b/Telegram/SourceFiles/info/info_top_bar.cpp index fe1ee0260d..38f6baf79f 100644 --- a/Telegram/SourceFiles/info/info_top_bar.cpp +++ b/Telegram/SourceFiles/info/info_top_bar.cpp @@ -254,12 +254,6 @@ void TopBar::startHighlightAnimation() { rpl::producer TitleValue( const Section §ion, not_null peer) { - if (section.type() == Section::Type::Members) { - return Profile::MembersCountValue(peer) - | rpl::map([](int count) { - return lng_chat_status_members(lt_count, count); - }); - } return Lang::Viewer([&] { switch (section.type()) { case Section::Type::Profile: @@ -298,6 +292,9 @@ rpl::producer TitleValue( case Section::Type::CommonGroups: return lng_profile_common_groups_section; + case Section::Type::Members: + return lng_profile_participants_section; + } Unexpected("Bad section type in Info::TitleValue()"); }()); diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 90a48b40b6..ac0ef0a095 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -85,6 +85,7 @@ auto AddActionButton( result->toggleOn( std::move(toggleOn) )->entity()->addClickHandler(std::move(callback)); + result->finishAnimating(); return result; }; @@ -314,8 +315,10 @@ Ui::MultiSlideTracker DetailsFiller::fillUserButtons( Ui::MultiSlideTracker tracker; auto window = _controller->window(); - auto sendMessageVisible = window->historyPeer.value() - | rpl::map($1 != user); + auto sendMessageVisible = rpl::combine( + _controller->wrapValue(), + window->historyPeer.value(), + ($1 != Wrap::Side) || ($2 != user)); auto sendMessage = [window, user] { window->showPeerHistory( user, @@ -343,8 +346,10 @@ Ui::MultiSlideTracker DetailsFiller::fillChannelButtons( Ui::MultiSlideTracker tracker; auto window = _controller->window(); - auto viewChannelVisible = window->historyPeer.value() - | rpl::map($1 != channel); + auto viewChannelVisible = rpl::combine( + _controller->wrapValue(), + window->historyPeer.value(), + ($1 != Wrap::Side) || ($2 != channel)); auto viewChannel = [=] { window->showPeerHistory( channel, diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index 2f26b0abbd..fca5898859 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -25,11 +25,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "data/data_photo.h" #include "info/profile/info_profile_values.h" #include "info/info_controller.h" +#include "info/info_memento.h" #include "lang/lang_keys.h" #include "styles/style_info.h" #include "ui/widgets/labels.h" #include "ui/effects/ripple_animation.h" #include "ui/special_buttons.h" +#include "window/window_controller.h" #include "observer_peer.h" #include "messenger.h" #include "auth_session.h" @@ -228,6 +230,7 @@ Cover::Cover( st::infoProfilePhotoTop + st::infoProfilePhoto.size.height() + st::infoProfilePhotoBottom) +, _controller(controller) , _peer(peer) , _userpic( this, @@ -236,12 +239,19 @@ Cover::Cover( Ui::UserpicButton::Role::OpenPhoto, st::infoProfilePhoto) , _name(this, st::infoProfileNameLabel) -, _status(this, st::infoProfileStatusLabel) { +, _status( + this, + _peer->isMegagroup() + ? st::infoProfileMegagroupStatusLabel + : st::infoProfileStatusLabel) { _peer->updateFull(); _name->setSelectable(true); _name->setContextCopyText(lang(lng_profile_copy_fullname)); - _status->setAttribute(Qt::WA_TransparentForMouseEvents); + + if (!_peer->isMegagroup()) { + _status->setAttribute(Qt::WA_TransparentForMouseEvents); + } initViewers(); setupChildGeometry(); @@ -332,7 +342,13 @@ void Cover::refreshNameText() { } void Cover::refreshStatusText() { - auto statusText = [this] { + auto hasMembersLink = [&] { + if (auto megagroup = _peer->asMegagroup()) { + return megagroup->canViewMembers(); + } + return false; + }(); + auto statusText = [&] { auto currentTime = unixtime(); if (auto user = _peer->asUser()) { auto result = App::onlineText(user, currentTime, true); @@ -349,14 +365,22 @@ void Cover::refreshStatusText() { return ChatStatusText(fullCount, _onlineCount, true); } else if (auto channel = _peer->asChannel()) { auto fullCount = qMax(channel->membersCount(), 1); - return ChatStatusText( + auto result = ChatStatusText( fullCount, _onlineCount, channel->isMegagroup()); + return hasMembersLink ? textcmdLink(1, result) : result; } return lang(lng_chat_status_unaccessible); }(); _status->setRichText(statusText); + if (hasMembersLink) { + _status->setLink(1, MakeShared([=] { + _controller->window()->showSection(Info::Memento( + _controller->peerId(), + Section::Type::Members)); + })); + } refreshStatusGeometry(width()); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.h b/Telegram/SourceFiles/info/profile/info_profile_cover.h index 3da087dd8b..10921ccaf2 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.h +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.h @@ -86,6 +86,7 @@ private: void refreshUploadPhotoOverlay(); void setVerified(bool verified); + not_null _controller; not_null _peer; int _onlineCount = 0; diff --git a/Telegram/SourceFiles/info/profile/info_profile_members.cpp b/Telegram/SourceFiles/info/profile/info_profile_members.cpp index e8a9985660..ee85c8d15d 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_members.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_members.cpp @@ -47,7 +47,7 @@ namespace Info { namespace Profile { namespace { -constexpr auto kEnableSearchMembersAfterCount = 1; +constexpr auto kEnableSearchMembersAfterCount = 20; } // namespace