diff options
Diffstat (limited to 'search_by_any_user.patch')
-rw-r--r-- | search_by_any_user.patch | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/search_by_any_user.patch b/search_by_any_user.patch new file mode 100644 index 000000000000..931a52bb46bb --- /dev/null +++ b/search_by_any_user.patch @@ -0,0 +1,111 @@ +Author: TheWug (https://github.com/TheWug) +Description: Allows searching by any user instead of only members of a chat + +diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +index dfea07f62..617ba8d6a 100644 +--- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp ++++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +@@ -312,6 +312,8 @@ void AddSpecialBoxController::prepare() { + delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); + auto title = [&] { + switch (_role) { ++ case Role::Members: ++ return tr::lng_profile_participants_section(); + case Role::Admins: + return tr::lng_channel_add_admin(); + case Role::Restricted: +diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp +index b5823b308..a474436e1 100644 +--- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp ++++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp +@@ -19,18 +19,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + namespace Dialogs { + + void ShowSearchFromBox( +- not_null<Window::SessionNavigation*> navigation, + not_null<PeerData*> peer, + Fn<void(not_null<UserData*>)> callback, + Fn<void()> closedCallback) { + auto createController = [ +- navigation, + peer, + callback = std::move(callback) + ]() -> std::unique_ptr<PeerListController> { + if (peer && (peer->isChat() || peer->isMegagroup())) { + return std::make_unique<Dialogs::SearchFromController>( +- navigation, + peer, + std::move(callback)); + } +@@ -50,18 +47,18 @@ void ShowSearchFromBox( + } + + SearchFromController::SearchFromController( +- not_null<Window::SessionNavigation*> navigation, + not_null<PeerData*> peer, + Fn<void(not_null<UserData*>)> callback) +-: ParticipantsBoxController( +- navigation, ++: AddSpecialBoxController( + peer, +- ParticipantsBoxController::Role::Members) ++ ParticipantsBoxController::Role::Members, ++ AdminDoneCallback(), ++ BannedDoneCallback()) + , _callback(std::move(callback)) { + } + + void SearchFromController::prepare() { +- ParticipantsBoxController::prepare(); ++ AddSpecialBoxController::prepare(); + delegate()->peerListSetTitle(tr::lng_search_messages_from()); + } + +diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h +index 3a45b7b5c..709353bb5 100644 +--- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h ++++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h +@@ -8,20 +8,18 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #pragma once + + #include "boxes/peer_list_box.h" +-#include "boxes/peers/edit_participants_box.h" ++#include "boxes/peers/add_participants_box.h" + + namespace Dialogs { + + void ShowSearchFromBox( +- not_null<Window::SessionNavigation*> navigation, + not_null<PeerData*> peer, + Fn<void(not_null<UserData*>)> callback, + Fn<void()> closedCallback); + +-class SearchFromController : public ParticipantsBoxController { ++class SearchFromController : public AddSpecialBoxController { + public: + SearchFromController( +- not_null<Window::SessionNavigation*> navigation, + not_null<PeerData*> peer, + Fn<void(not_null<UserData*>)> callback); + +@@ -29,7 +27,7 @@ public: + void rowClicked(not_null<PeerListRow*> row) override; + + protected: +- std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user) const override; ++ std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user) const; + + private: + Fn<void(not_null<UserData*>)> _callback; +diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +index 68797353e..888b2dc4d 100644 +--- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp ++++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +@@ -1322,7 +1322,6 @@ void Widget::showSearchFrom() { + if (const auto peer = _searchInChat.peer()) { + const auto chat = _searchInChat; + ShowSearchFromBox( +- controller(), + peer, + crl::guard(this, [=](not_null<UserData*> user) { + Ui::hideLayer();
\ No newline at end of file |