diff --git a/Telegram/Resources/icons/menu/community.svg b/Telegram/Resources/icons/menu/community.svg
new file mode 100644
index 0000000000..ca76fa7e99
--- /dev/null
+++ b/Telegram/Resources/icons/menu/community.svg
@@ -0,0 +1,6 @@
+
+
diff --git a/Telegram/Resources/icons/menu/pending_requests.svg b/Telegram/Resources/icons/menu/pending_requests.svg
new file mode 100644
index 0000000000..bbe39fc0e9
--- /dev/null
+++ b/Telegram/Resources/icons/menu/pending_requests.svg
@@ -0,0 +1,6 @@
+
+
diff --git a/Telegram/Resources/icons/menu/removed_users.svg b/Telegram/Resources/icons/menu/removed_users.svg
new file mode 100644
index 0000000000..224f85694a
--- /dev/null
+++ b/Telegram/Resources/icons/menu/removed_users.svg
@@ -0,0 +1,6 @@
+
+
diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings
index b7023d2684..a07ad6e1ea 100644
--- a/Telegram/Resources/langs/lang.strings
+++ b/Telegram/Resources/langs/lang.strings
@@ -2259,6 +2259,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_community_requests_decline_all_title" = "Decline All";
"lng_community_requests_decline_all_sure#one" = "Do you want to decline {count} request to join the community?";
"lng_community_requests_decline_all_sure#other" = "Do you want to decline all {count} requests to join the community?";
+"lng_community_request_added_toast#one" = "Chat was added to the community.";
+"lng_community_request_added_toast#other" = "{count} chats were added to the community.";
+"lng_community_request_declined_toast#one" = "Request to add chat was declined.";
+"lng_community_request_declined_toast#other" = "{count} requests to add chats were declined.";
"lng_community_ban_toggle" = "Ban from the Community";
"lng_community_ban_about#one" = "User will be removed from {count} chat.";
"lng_community_ban_about#other" = "User will be removed from {count} chats.";
@@ -2267,7 +2271,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_community_ban_warning#other" = "Banning {user} will also remove {count} their chats from the community.";
"lng_community_ban_button" = "Ban";
"lng_community_ban_done" = "{user} was banned from the community.";
-"lng_community_profile_view" = "View Community";
+"lng_community_profile_status#one" = "Community with {count} chat";
+"lng_community_profile_status#other" = "Community with {count} chats";
"lng_community_hidden_chat_about" = "Only invited members and community admins will see this chat.";
"lng_community_admin_title" = "You are a community admin";
"lng_community_admin_about" = "You can now edit {community} info and use other admin tools.";
@@ -2275,6 +2280,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_community_admin_decline" = "No, thanks";
"lng_community_admin_dismiss_title" = "Dismiss yourself as community admin";
"lng_community_admin_dismiss_text" = "You'll lose access to community admin tools, but keep your group admin rights.";
+"lng_community_removed_list_about" = "Users removed from the community will be shown here.";
"lng_manage_monoforum" = "Direct Messages";
"lng_manage_monoforum_off" = "Off";
diff --git a/Telegram/SourceFiles/api/api_communities.cpp b/Telegram/SourceFiles/api/api_communities.cpp
index d4cd31b0ad..2c08bb83a3 100644
--- a/Telegram/SourceFiles/api/api_communities.cpp
+++ b/Telegram/SourceFiles/api/api_communities.cpp
@@ -205,6 +205,9 @@ void Communities::requestPeerLinkRequests(
auto &owner = _session->data();
owner.processUsers(data.vusers());
owner.processChats(data.vchats());
+ community->setPendingRequestsCount(
+ data.vtotal_count().v,
+ QVector());
auto slice = CommunityPeerRequestsSlice();
slice.totalCount = data.vtotal_count().v;
slice.nextOffset = qs(data.vnext_offset().value_or_empty());
@@ -241,6 +244,9 @@ void Communities::togglePeerLinkRequestApproval(
community->inputChannel(),
peer->input()
)).done([=] {
+ community->setPendingRequestsCount(
+ std::max(community->pendingRequestsCount() - 1, 0),
+ QVector());
_session->api().requestFullPeer(community);
if (done) {
done();
@@ -262,6 +268,7 @@ void Communities::toggleAllPeerLinkRequestApproval(
MTP_flags(reject ? Flag::f_reject : Flag()),
community->inputChannel()
)).done([=] {
+ community->setPendingRequestsCount(0, QVector());
_session->api().requestFullPeer(community);
if (done) {
done();
diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style
index f3b44a80c6..0dd1dc9c6d 100644
--- a/Telegram/SourceFiles/boxes/boxes.style
+++ b/Telegram/SourceFiles/boxes/boxes.style
@@ -1552,3 +1552,7 @@ aiComposeBoxInfoButton: IconButton(boxTitleClose) {
ripple: defaultRippleAnimation;
}
aiComposeShadowOpacity: 0.3;
+communityBoxManage: IconButton(boxTitleClose) {
+ icon: icon {{ "menu/manage", boxTitleCloseFg }};
+ iconOver: icon {{ "menu/manage", boxTitleCloseFgOver }};
+}
diff --git a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp
index 9f2e732a72..6ee22b2f61 100644
--- a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp
+++ b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp
@@ -1413,6 +1413,7 @@ void CreateModerateMessagesBox(
return nullptr;
}
Ui::AddSkip(inner);
+ Ui::AddSkip(inner);
const auto result = inner->add(
object_ptr(
box,
@@ -1420,22 +1421,29 @@ void CreateModerateMessagesBox(
false,
st::defaultBoxCheckbox),
st::boxRowPadding + buttonPadding);
+ Ui::AddSkip(inner);
+ Ui::AddSkip(inner);
const auto info = community->communityInfo();
const auto chatsCount = info
? int(info->linkedPeers().size())
: 0;
if (chatsCount > 0) {
- Ui::AddSkip(inner);
- inner->add(object_ptr(
- inner,
- object_ptr(
+ const auto aboutWrap = inner->add(
+ object_ptr>(
inner,
+ object_ptr(inner)));
+ aboutWrap->entity()->add(object_ptr(
+ aboutWrap->entity(),
+ object_ptr(
+ aboutWrap->entity(),
tr::lng_community_ban_about(
tr::now,
lt_count,
chatsCount),
st::moderateBoxDividerLabel),
st::defaultBoxDividerLabelPadding));
+ aboutWrap->toggleOn(result->checkedValue());
+ aboutWrap->finishAnimating();
}
return result;
}();
diff --git a/Telegram/SourceFiles/boxes/peers/community_box.cpp b/Telegram/SourceFiles/boxes/peers/community_box.cpp
index 7e34d1c357..2916e259d8 100644
--- a/Telegram/SourceFiles/boxes/peers/community_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/community_box.cpp
@@ -143,8 +143,9 @@ void CommunityBox(
}
const auto container = box->verticalLayout();
+ box->addTopButton(st::boxTitleClose, [=] { box->closeBox(); });
if (community->canEditInformation()) {
- box->addTopButton(st::infoTopBarMenu, [=] {
+ box->addTopButton(st::communityBoxManage, [=] {
ShowManageCommunityBox(navigation, community);
});
}
@@ -185,7 +186,7 @@ void CommunityBox(
lt_count,
rpl::duplicate(count) | tr::to_count()),
st::settingsButton,
- { &st::menuIconInvite }
+ { &st::menuIconPendingRequests }
)->addClickHandler([=] {
ShowCommunityPendingRequestsBox(navigation, community);
});
@@ -265,15 +266,10 @@ void CommunityBox(
return c.requestable;
}));
- const auto canAdd = community->canManageLinkedPeers()
- || community->communityAnyoneCanAddPeers();
- if (canAdd) {
- box->addButton(tr::lng_community_add_chat(), [=] {
- ShowChooseChatToAddBox(navigation, community);
- });
- } else {
- box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
- }
+ box->addButton(tr::lng_community_add_chat(), [=] {
+ ShowChooseChatToAddBox(navigation, community);
+ });
+ box->addButton(tr::lng_close(), [=] { box->closeBox(); });
if (!community->wasFullUpdated()) {
community->session().api().requestFullPeer(community);
@@ -313,6 +309,7 @@ Main::Session &ChooseChatController::session() const {
void ChooseChatController::prepare() {
delegate()->peerListSetTitle(tr::lng_community_add_chat());
+ delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
auto candidates = std::vector>();
_session->data().enumerateGroups([&](not_null peer) {
const auto channel = peer->asChannel();
diff --git a/Telegram/SourceFiles/boxes/peers/community_pending_requests_box.cpp b/Telegram/SourceFiles/boxes/peers/community_pending_requests_box.cpp
index cf80d03451..d4615a80f1 100644
--- a/Telegram/SourceFiles/boxes/peers/community_pending_requests_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/community_pending_requests_box.cpp
@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_peer.h"
#include "data/data_session.h"
#include "data/data_user.h"
+#include "info/profile/info_profile_values.h"
#include "lang/lang_keys.h"
#include "main/main_session.h"
#include "ui/boxes/confirm_box.h"
@@ -215,6 +216,10 @@ public:
not_null row,
int element) override;
+ void setCloseBox(Fn closeBox) {
+ _closeBox = std::move(closeBox);
+ }
+
QSize rowAcceptButtonSize() override;
QSize rowRejectButtonSize() override;
void rowPaintAccept(
@@ -246,6 +251,7 @@ private:
const not_null _navigation;
const not_null _community;
+ Fn _closeBox;
QString _offset;
bool _allLoaded = false;
@@ -341,6 +347,20 @@ void Controller::process(not_null row, bool reject) {
delegate()->peerListRemoveRow(row);
delegate()->peerListRefreshRows();
}
+ if (_allLoaded
+ && !delegate()->peerListFullRowsCount()
+ && _closeBox) {
+ _closeBox();
+ }
+ _navigation->uiShow()->showToast(reject
+ ? tr::lng_community_request_declined_toast(
+ tr::now,
+ lt_count,
+ 1)
+ : tr::lng_community_request_added_toast(
+ tr::now,
+ lt_count,
+ 1));
}),
crl::guard(this, [=](const QString &error) {
delegate()->peerListUiShow()->showToast(error);
@@ -348,15 +368,19 @@ void Controller::process(not_null row, bool reject) {
}
QSize Controller::rowAcceptButtonSize() {
- return QSize(
- _acceptTextWidth + st::requestsAcceptButton.width,
- st::requestsAcceptButton.height);
+ const auto &st = st::requestsAcceptButton;
+ return {
+ (st.width <= 0) ? (_acceptTextWidth - st.width) : st.width,
+ st.height,
+ };
}
QSize Controller::rowRejectButtonSize() {
- return QSize(
- _rejectTextWidth + st::requestsRejectButton.width,
- st::requestsRejectButton.height);
+ const auto &st = st::requestsRejectButton;
+ return {
+ (st.width <= 0) ? (_rejectTextWidth - st.width) : st.width,
+ st.height,
+ };
}
void Controller::rowPaintAccept(
@@ -433,16 +457,31 @@ void ShowCommunityPendingRequestsBox(
not_null navigation,
not_null community) {
auto controller = std::make_unique(navigation, community);
+ const auto raw = controller.get();
const auto init = [=](not_null box) {
- const auto count = std::max(community->pendingRequestsCount(), 1);
+ raw->setCloseBox(crl::guard(box, [=] { box->closeBox(); }));
const auto processAll = [=](bool reject) {
+ const auto count = std::max(
+ community->pendingRequestsCount(),
+ 1);
const auto sure = [=](Fn &&close) {
close();
community->session().api().communities(
).toggleAllPeerLinkRequestApproval(
community,
reject,
- crl::guard(box, [=] { box->closeBox(); }),
+ crl::guard(box, [=] {
+ box->closeBox();
+ navigation->uiShow()->showToast(reject
+ ? tr::lng_community_request_declined_toast(
+ tr::now,
+ lt_count,
+ count)
+ : tr::lng_community_request_added_toast(
+ tr::now,
+ lt_count,
+ count));
+ }),
crl::guard(box, [=](const QString &error) {
box->uiShow()->showToast(error);
}));
@@ -466,9 +505,11 @@ void ShowCommunityPendingRequestsBox(
: tr::lng_community_requests_add_all_title()),
}));
};
+ box->addTopButton(st::boxTitleClose, [=] { box->closeBox(); });
box->addButton(
tr::lng_community_requests_add_all(),
[=] { processAll(false); });
+ box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
box->addLeftButton(
tr::lng_community_requests_decline_all(),
[=] { processAll(true); });
@@ -480,7 +521,11 @@ void ShowCommunityPendingRequestsBox(
above,
tr::lng_community_requests_count(
lt_count,
- rpl::single(float64(count))));
+ Info::Profile::PendingRequestsCountValue(
+ community
+ ) | rpl::map([](int count) {
+ return float64(std::max(count, 1));
+ })));
box->peerListSetAboveWidget(std::move(above));
};
navigation->uiShow()->showBox(Box(
diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
index 0e15d51d9a..5534c68532 100644
--- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp
@@ -1787,8 +1787,11 @@ void ParticipantsBoxController::loadMoreRows() {
}
void ParticipantsBoxController::refreshDescription() {
+ const auto channel = _peer->asChannel();
setDescriptionText((_role == Role::Kicked)
- ? ((_peer->isChat() || _peer->isMegagroup())
+ ? ((channel && channel->isCommunity())
+ ? tr::lng_community_removed_list_about
+ : (_peer->isChat() || _peer->isMegagroup())
? tr::lng_group_removed_list_about
: tr::lng_channel_removed_list_about)(tr::now)
: (delegate()->peerListFullRowsCount() > 0)
diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp
index a46874cfdd..6df056e7fc 100644
--- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp
@@ -1673,7 +1673,7 @@ void Controller::fillManageSection() {
_peer,
ParticipantsBoxController::Role::Kicked);
},
- { &st::menuIconRemove });
+ { &st::menuIconRemovedUsers });
}
if (hasRecentActions) {
auto callback = [=] {
@@ -1706,14 +1706,14 @@ void Controller::fillManageSection() {
tr::lng_community_add_button(),
rpl::single(QString()),
[=] { ShowAddToCommunityBox(_navigation, channel); },
- { &st::menuIconGroups });
+ { &st::menuIconCommunity });
::AddSkip(_controls.buttonsLayout);
Ui::AddDividerText(
_controls.buttonsLayout,
tr::lng_community_add_about());
}
- if (canEditStickers || canDeleteChannel) {
+ if ((canEditStickers || canDeleteChannel) && !canAddToCommunity) {
::AddSkip(_controls.buttonsLayout);
}
diff --git a/Telegram/SourceFiles/boxes/peers/manage_community_box.cpp b/Telegram/SourceFiles/boxes/peers/manage_community_box.cpp
index 587079e903..f1d598097a 100644
--- a/Telegram/SourceFiles/boxes/peers/manage_community_box.cpp
+++ b/Telegram/SourceFiles/boxes/peers/manage_community_box.cpp
@@ -114,7 +114,6 @@ void ManageCommunityBox(
const auto container = box->verticalLayout();
- Ui::AddSubsectionTitle(container, tr::lng_community_manage_name());
const auto field = container->add(
object_ptr(
container,
@@ -126,7 +125,7 @@ void ManageCommunityBox(
field->setEnabled(false);
}
- Ui::AddSkip(container);
+ Ui::AddSkip(container, st::defaultVerticalListSkip * 2);
Ui::AddDivider(container);
Ui::AddSkip(container);
@@ -156,16 +155,18 @@ void ManageCommunityBox(
radio->setDisabled(true);
}
};
+ Ui::AddSkip(container, st::defaultVerticalListSkip * 2);
addOption(
0,
tr::lng_community_manage_all_members(tr::now),
tr::lng_community_manage_all_members_about());
+ Ui::AddSkip(container, st::defaultVerticalListSkip * 2);
addOption(
1,
tr::lng_community_manage_only_admins(tr::now),
tr::lng_community_manage_only_admins_about());
+ Ui::AddSkip(container, st::defaultVerticalListSkip * 2);
- Ui::AddSkip(container);
Ui::AddDivider(container);
Ui::AddSkip(container);
@@ -194,7 +195,7 @@ void ManageCommunityBox(
tr::lng_community_requests_title(),
PositiveNumberString(rpl::duplicate(count)),
st::settingsButton,
- { &st::menuIconInvite }
+ { &st::menuIconPendingRequests }
)->addClickHandler([=] {
ShowCommunityPendingRequestsBox(navigation, community);
});
@@ -208,7 +209,7 @@ void ManageCommunityBox(
tr::lng_manage_peer_removed_users(),
PositiveNumberString(Info::Profile::KickedCountValue(community)),
st::settingsButton,
- { &st::menuIconRemove }
+ { &st::menuIconRemovedUsers }
)->addClickHandler([=] {
ParticipantsBoxController::Start(
navigation,
diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style
index b40d34b582..aa1664b4ab 100644
--- a/Telegram/SourceFiles/dialogs/dialogs.style
+++ b/Telegram/SourceFiles/dialogs/dialogs.style
@@ -157,6 +157,7 @@ dialogsSubscriptionBadgeSkip: point(-4px, -4px);
dialogsCommunityBadgeSize: 16px;
dialogsCommunityBadgeSkip: point(-3px, -3px);
dialogsCommunityBadgeStroke: 2px;
+dialogsCommunityBadgeLine: 1px;
dialogsTTLBadgeSize: 20px;
dialogsTTLBadgeInnerMargins: margins(2px, 2px, 2px, 2px);
diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp
index 8270b392e7..aab0edb806 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp
@@ -504,28 +504,22 @@ void Row::PaintCornerBadgeFrame(
auto pen = QPen(Qt::transparent);
pen.setWidthF(st::dialogsCommunityBadgeStroke);
q.setPen(pen);
- q.setBrush(data->active
- ? st::dialogsVerifiedIconBgActive
- : st::dialogsVerifiedIconBg);
+ q.setBrush(st::windowFg);
q.drawEllipse(rect);
q.setCompositionMode(QPainter::CompositionMode_SourceOver);
const auto center = rect.center();
- const auto radius = size / 5.;
- auto arrow = QPen(data->active
- ? st::dialogsVerifiedIconFgActive
- : st::dialogsVerifiedIconFg);
- arrow.setWidthF(st::dialogsCommunityBadgeStroke / 2.);
+ const auto arm = size / 4.;
+ auto arrow = QPen(st::windowBg->c);
+ arrow.setWidthF(st::dialogsCommunityBadgeLine);
arrow.setCapStyle(Qt::RoundCap);
- arrow.setJoinStyle(Qt::RoundJoin);
+ arrow.setJoinStyle(Qt::MiterJoin);
q.setPen(arrow);
q.setBrush(Qt::NoBrush);
auto path = QPainterPath();
- path.moveTo(center.x() - radius, center.y() + radius);
- path.lineTo(center.x() + radius, center.y() - radius);
- path.moveTo(center.x() - radius * 0.4, center.y() - radius);
- path.lineTo(center.x() + radius, center.y() - radius);
- path.lineTo(center.x() + radius, center.y() + radius * 0.4);
+ path.moveTo(center.x() - arm, center.y() - arm / 2.);
+ path.lineTo(center.x(), center.y() + arm / 2.);
+ path.lineTo(center.x() + arm, center.y() - arm / 2.);
q.drawPath(path);
return;
}
@@ -695,7 +689,10 @@ void Row::paintUserpic(
context.st->padding.top() - framePadding,
_cornerBadgeUserpic->frame);
const auto history = _id.history();
- if (!history || history->peer->isUser() || subscribed) {
+ if (!history
+ || history->peer->isUser()
+ || subscribed
+ || communityMember) {
return;
}
const auto actionPainter = history->sendActionPainter();
diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp
index 6e783f5674..34e98a067d 100644
--- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp
+++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp
@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/qt/qt_key_modifiers.h"
#include "base/timer_rpl.h"
#include "base/unixtime.h"
+#include "boxes/peer_list_box.h"
#include "boxes/peers/add_bot_to_chat_box.h"
#include "boxes/peers/community_box.h"
#include "boxes/peers/edit_contact_box.h"
@@ -2546,25 +2547,72 @@ Section DetailsFiller::makeCommunityLink(not_null channel) {
parent,
object_ptr(parent));
const auto raw = wrap.data();
+ const auto container = raw->entity();
const auto window = _controller->parentController();
const auto community = channel->owner().channel(
channel->linkedCommunityId());
- AddMainButton(
- raw->entity(),
- tr::lng_community_profile_view(),
- rpl::single(true),
- [=] { ShowCommunityBox(window, community); },
- nullptr,
- nullptr);
- const auto hiddenWrap = raw->entity()->add(
- object_ptr>(
- raw->entity(),
- object_ptr(raw->entity())));
- Ui::AddDividerText(
- hiddenWrap->entity(),
- tr::lng_community_hidden_chat_about());
- auto hiddenValue = rpl::single(rpl::empty) | rpl::then(
+ class Controller final : public PeerListController {
+ public:
+ Controller(not_null community, Fn open)
+ : _community(community)
+ , _open(std::move(open)) {
+ setStyleOverrides(&st::peerListSingleRow);
+ }
+
+ Main::Session &session() const override {
+ return _community->session();
+ }
+ void prepare() override {
+ auto row = std::make_unique(_community);
+ const auto rawRow = row.get();
+ const auto updateStatus = [=] {
+ const auto info = _community->communityInfo();
+ const auto count = info
+ ? int(info->linkedPeers().size())
+ : 0;
+ rawRow->setCustomStatus(count
+ ? tr::lng_community_profile_status(
+ tr::now,
+ lt_count,
+ count)
+ : tr::lng_community_title(tr::now));
+ };
+ updateStatus();
+ delegate()->peerListAppendRow(std::move(row));
+ delegate()->peerListRefreshRows();
+ _community->session().changes().peerUpdates(
+ _community,
+ Data::PeerUpdate::Flag::FullInfo
+ ) | rpl::on_next([=] {
+ updateStatus();
+ delegate()->peerListUpdateRow(rawRow);
+ }, lifetime());
+ }
+ void rowClicked(not_null row) override {
+ _open();
+ }
+
+ private:
+ const not_null _community;
+ Fn _open;
+
+ };
+
+ const auto delegate = container->lifetime().make_state<
+ PeerListContentDelegateSimple
+ >();
+ const auto controller = container->lifetime().make_state(
+ community,
+ [=] { ShowCommunityBox(window, community); });
+ const auto content = container->add(object_ptr(
+ container,
+ controller));
+ AddSkip(container, st::infoProfileSkip);
+ delegate->setContent(content);
+ controller->setDelegate(delegate);
+
+ auto hidden = rpl::single(rpl::empty) | rpl::then(
channel->session().changes().peerUpdates(
community,
Data::PeerUpdate::Flag::FullInfo
@@ -2580,10 +2628,32 @@ Section DetailsFiller::makeCommunityLink(not_null channel) {
}
}
return false;
- });
- hiddenWrap->toggleOn(std::move(hiddenValue), anim::type::instant);
+ }) | rpl::start_spawning(container->lifetime());
+
+ const auto hiddenWrap = container->add(
+ object_ptr>(
+ container,
+ object_ptr(container)));
+ Ui::AddDividerText(
+ hiddenWrap->entity(),
+ tr::lng_community_hidden_chat_about());
+ hiddenWrap->toggleOn(rpl::duplicate(hidden), anim::type::instant);
hiddenWrap->finishAnimating();
+ const auto plainWrap = container->add(
+ object_ptr>(
+ container,
+ object_ptr(container)));
+ Ui::AddDivider(plainWrap->entity());
+ plainWrap->toggleOn(
+ std::move(hidden) | rpl::map(!rpl::mappers::_1),
+ anim::type::instant);
+ plainWrap->finishAnimating();
+
+ if (!community->wasFullUpdated()) {
+ community->session().api().requestFullPeer(community);
+ }
+
raw->toggle(true, anim::type::instant);
return Section{
.widget = std::move(wrap),
@@ -2637,6 +2707,11 @@ void DetailsFiller::buildSections() {
_stack->add(makePersonalChannel(user));
_stack->addPlainSeparator();
}
+ if (const auto channel = _peer->asChannel()) {
+ if (channel->linkedCommunityId()) {
+ _stack->add(makeCommunityLink(channel));
+ }
+ }
_stack->add(makeInfo());
if (const auto user = _peer->asUser()) {
_stack->add(makeAddAsContact(user));
@@ -2665,9 +2740,6 @@ void DetailsFiller::buildSections() {
if (!channel->isMegagroup()) {
_stack->add(makeViewChannel(channel));
}
- if (channel->linkedCommunityId()) {
- _stack->add(makeCommunityLink(channel));
- }
if (const auto forum = channel->forum()) {
_stack->add(makeTopicsList(forum));
}
diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style
index 443b66e92d..3fe3045f60 100644
--- a/Telegram/SourceFiles/ui/menu_icons.style
+++ b/Telegram/SourceFiles/ui/menu_icons.style
@@ -220,6 +220,9 @@ menuIconTagEdit: icon{{ "menu/tag_edit-24x24", menuIconColor }};
menuIconDownloadOff: icon {{ "menu/download_off-24x24", menuIconColor }};
menuIconShareOff: icon {{ "menu/share_off-24x24", menuIconColor }};
menuIconShareOn: icon {{ "menu/share_on-24x24", menuIconColor }};
+menuIconCommunity: icon {{ "menu/community-24x24", menuIconColor }};
+menuIconPendingRequests: icon {{ "menu/pending_requests-24x24", menuIconColor }};
+menuIconRemovedUsers: icon {{ "menu/removed_users-24x24", menuIconColor }};
menuIconStar: icon {{ "menu/star", menuIconColor }};
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};