From 56cb5ac9c6b138d42c22d58b85541f49e6cc2cb3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 11 Jul 2017 21:39:09 +0300 Subject: [PATCH] Alpha 1.1.12: Search in supergroup for count > 50. Also move search in supergroup members to Actions profile block. --- Telegram/SourceFiles/apiwrap.cpp | 2 +- .../SourceFiles/profile/profile_block_actions.cpp | 12 ++++++++++++ Telegram/SourceFiles/profile/profile_block_actions.h | 1 + .../SourceFiles/profile/profile_block_settings.cpp | 12 ------------ .../SourceFiles/profile/profile_block_settings.h | 2 -- changelog.txt | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 64626278a..2b89f60be 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -102,7 +102,7 @@ void ApiWrap::addLocalChangelogs(int oldAppVersion) { addLocalAlphaChangelog(1001008, "\xE2\x80\x94 Toggle night mode in the main menu.\n"); addLocalAlphaChangelog(1001010, "\xE2\x80\x94 Filter added to channel and supergroup event log.\n\xE2\x80\x94 Search by username in privacy exceptions editor fixed.\n\xE2\x80\x94 Adding admins in channels fixed."); addLocalAlphaChangelog(1001011, "\xE2\x80\x94 Send **bold** and __italic__ text in your messages (in addition to already supported `monospace` and ```multiline monospace```).\n\xE2\x80\x94 Search in channel and supergroup admin event log.\n\xE2\x80\x94 Ban members from right click menu in supergroup admin event log."); - addLocalAlphaChangelog(1001012, "\xE2\x80\x94 Click on forwarded messages bar to change the recipient chat in case you chose a wrong one first.\n\xE2\x80\x94 Quickly share posts from channels and media messages from bots.\n\xE2\x80\x94 Search in supergroup members by name.\n\xE2\x80\x94 Search in channel members by name if you're a channel admin.\n\xE2\x80\x94 Copy links to messages in public supergroups."); + addLocalAlphaChangelog(1001012, "\xE2\x80\x94 Click on forwarded messages bar to change the recipient chat in case you chose a wrong one first.\n\xE2\x80\x94 Quickly share posts from channels and media messages from bots.\n\xE2\x80\x94 Search in large supergroup members by name.\n\xE2\x80\x94 Search in channel members by name if you're a channel admin.\n\xE2\x80\x94 Copy links to messages in public supergroups."); } if (!addedSome) { auto text = lng_new_version_wrap(lt_version, str_const_toString(AppVersionStr), lt_changes, lang(lng_new_version_minor), lt_link, qsl("https://desktop.telegram.org/changelog")).trimmed(); diff --git a/Telegram/SourceFiles/profile/profile_block_actions.cpp b/Telegram/SourceFiles/profile/profile_block_actions.cpp index 5642f6b28..3a3de93d7 100644 --- a/Telegram/SourceFiles/profile/profile_block_actions.cpp +++ b/Telegram/SourceFiles/profile/profile_block_actions.cpp @@ -30,9 +30,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "apiwrap.h" #include "auth_session.h" #include "lang/lang_keys.h" +#include "profile/profile_channel_controllers.h" namespace Profile { +constexpr auto kEnableSearchMembersAfterCount = 50; + using UpdateFlag = Notify::PeerUpdate::Flag; ActionsWidget::ActionsWidget(QWidget *parent, PeerData *peer) : BlockWidget(parent, peer, lang(lng_profile_actions_section)) { @@ -142,6 +145,9 @@ void ActionsWidget::refreshButtons() { addButton(lang(lng_profile_clear_history), SLOT(onClearHistory())); addButton(lang(lng_profile_clear_and_exit), SLOT(onDeleteConversation())); } else if (auto channel = peer()->asChannel()) { + if (channel->isMegagroup() && channel->membersCount() > kEnableSearchMembersAfterCount) { + addButton(lang(lng_profile_search_members), SLOT(onSearchMembers())); + } if (!channel->amCreator() && (!channel->isMegagroup() || channel->isPublic())) { addButton(lang(lng_profile_report), SLOT(onReport())); } @@ -347,6 +353,12 @@ void ActionsWidget::onLeaveChannel() { }))); } +void ActionsWidget::onSearchMembers() { + if (auto channel = peer()->asChannel()) { + ParticipantsBoxController::Start(channel, ParticipantsBoxController::Role::Members); + } +} + void ActionsWidget::onReport() { Ui::show(Box(peer())); } diff --git a/Telegram/SourceFiles/profile/profile_block_actions.h b/Telegram/SourceFiles/profile/profile_block_actions.h index 64fb367d9..a97aa5102 100644 --- a/Telegram/SourceFiles/profile/profile_block_actions.h +++ b/Telegram/SourceFiles/profile/profile_block_actions.h @@ -57,6 +57,7 @@ private slots: void onDeleteConversation(); void onBlockUser(); void onUpgradeToSupergroup(); + void onSearchMembers(); void onDeleteChannel(); void onLeaveChannel(); void onReport(); diff --git a/Telegram/SourceFiles/profile/profile_block_settings.cpp b/Telegram/SourceFiles/profile/profile_block_settings.cpp index 4d7e841fe..78c74e123 100644 --- a/Telegram/SourceFiles/profile/profile_block_settings.cpp +++ b/Telegram/SourceFiles/profile/profile_block_settings.cpp @@ -96,7 +96,6 @@ int SettingsWidget::resizeGetHeight(int newWidth) { button->moveToLeft(left, newHeight); newHeight += button->height(); }; - moveLink(_searchMembers); moveLink(_manageAdmins); moveLink(_recentActions); moveLink(_manageBannedUsers); @@ -110,11 +109,6 @@ int SettingsWidget::resizeGetHeight(int newWidth) { void SettingsWidget::refreshButtons() { refreshEnableNotifications(); refreshManageAdminsButton(); - if (auto megagroup = peer()->asMegagroup()) { - _searchMembers.create(this, lang(lng_profile_search_members), st::defaultLeftOutlineButton); - _searchMembers->show(); - connect(_searchMembers, SIGNAL(clicked()), this, SLOT(onSearchMembers())); - } refreshManageBannedUsersButton(); refreshInviteLinkButton(); } @@ -214,12 +208,6 @@ void SettingsWidget::onNotificationsChange() { App::main()->updateNotifySetting(peer(), _enableNotifications->checked() ? NotifySettingSetNotify : NotifySettingSetMuted); } -void SettingsWidget::onSearchMembers() { - if (auto channel = peer()->asChannel()) { - ParticipantsBoxController::Start(channel, ParticipantsBoxController::Role::Members); - } -} - void SettingsWidget::onManageAdmins() { if (auto chat = peer()->asChat()) { Ui::show(Box(chat, MembersFilter::Admins)); diff --git a/Telegram/SourceFiles/profile/profile_block_settings.h b/Telegram/SourceFiles/profile/profile_block_settings.h index 6bb399957..35dd86513 100644 --- a/Telegram/SourceFiles/profile/profile_block_settings.h +++ b/Telegram/SourceFiles/profile/profile_block_settings.h @@ -45,7 +45,6 @@ protected: private slots: void onNotificationsChange(); - void onSearchMembers(); void onManageAdmins(); void onRecentActions(); void onManageBannedUsers(); @@ -63,7 +62,6 @@ private: void refreshInviteLinkButton(); object_ptr _enableNotifications; - object_ptr _searchMembers = { nullptr }; object_ptr _manageAdmins = { nullptr }; object_ptr _recentActions = { nullptr }; object_ptr _manageBannedUsers = { nullptr }; diff --git a/changelog.txt b/changelog.txt index bfc1492b6..f90b7f46c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,7 +2,7 @@ - Click on forwarded messages bar to change the recipient chat in case you chose a wrong one first. - Quickly share posts from channels and media messages from bots. -- Search in supergroup members by name. +- Search in large supergroup members by name. - Search in channel members by name if you're a channel admin. - Copy links to messages in public supergroups.