diff options
author | udf | 2019-08-18 03:52:00 +0200 |
---|---|---|
committer | udf | 2019-08-18 03:52:00 +0200 |
commit | 09bd40de3804be0c21da5d837ea4166cfe3ef2f1 (patch) | |
tree | 71ad71eab88dc1040c82d1d66b16dea5ec9560cd | |
parent | 55ba1a5b1e52cb3f401be3e36acb5dade3834a00 (diff) | |
download | aur-09bd40de3804be0c21da5d837ea4166cfe3ef2f1.tar.gz |
Update search_by_any_user to allow self searches
-rw-r--r-- | PKGBUILD | 2 | ||||
-rw-r--r-- | search_by_any_user.patch | 44 |
2 files changed, 41 insertions, 5 deletions
@@ -74,7 +74,7 @@ sha512sums=( '4a7e9de924bbf32fb4cd24ffa2764bcf49e0540bba649829b180da20a62810d4a21ebf11529d4eca22c9ceaa93b434ca3fbfd0b636795f8109ea4e1eddbff8f3' 'b4eeeb4b2801f3edcc7423f28403b1dfabd3f3869425e4f102a2a4554bde93e63bd73d2d4dbf3e5748ce831b570e441d3917f532fc5cceac1ee5e8fd0832cb30' '650a2a2568cacd2775979614c06c90a4c505207246eb229bbf4fccd8e9fc2540093eaa5bd748e3801c1e1b43beb89b19674c27c5f400d451475b0ee068b04ca2' - '94d39bada22391337a807420b58e3ec622c1e41dc0c5f03ffb18bcceef4f6b248efc9f22cbdeaafe9c876ec976a580f7cd09906c97c65e7917df8a11946f1f6f' + 'f2bee85f3e665b4fe2c1273d2dd8f1ce893e72f2280df6722b14acf5c78dc12b1b71b95c3f8d701f7495265df520cea0075f0299582b21ca0b2fd485d6cf66d6' ) prepare() { diff --git a/search_by_any_user.patch b/search_by_any_user.patch index cb624b7f58dd..e50f9524d4c3 100644 --- a/search_by_any_user.patch +++ b/search_by_any_user.patch @@ -2,9 +2,18 @@ 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 +index dfea07f62..e2e332577 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +@@ -299,7 +299,7 @@ void AddSpecialBoxController::migrate(not_null<ChannelData*> channel) { + + std::unique_ptr<PeerListRow> AddSpecialBoxController::createSearchRow( + not_null<PeerData*> peer) { +- if (peer->isSelf()) { ++ if (_excludeSelf && peer->isSelf()) { + return nullptr; + } + if (const auto user = peer->asUser()) { @@ -312,6 +312,8 @@ void AddSpecialBoxController::prepare() { delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled); auto title = [&] { @@ -14,8 +23,32 @@ index dfea07f62..617ba8d6a 100644 case Role::Admins: return tr::lng_channel_add_admin(); case Role::Restricted: +@@ -799,7 +801,8 @@ void AddSpecialBoxController::kickUser( + } + + bool AddSpecialBoxController::appendRow(not_null<UserData*> user) { +- if (delegate()->peerListFindRow(user->id) || user->isSelf()) { ++ if (delegate()->peerListFindRow(user->id) ++ || (_excludeSelf && user->isSelf())) { + return false; + } + delegate()->peerListAppendRow(createRow(user)); +diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.h b/Telegram/SourceFiles/boxes/peers/add_participants_box.h +index deef59d01..b1fab5a43 100644 +--- a/Telegram/SourceFiles/boxes/peers/add_participants_box.h ++++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.h +@@ -131,6 +131,9 @@ private: + AdminDoneCallback _adminDoneCallback; + BannedDoneCallback _bannedDoneCallback; + ++protected: ++ bool _excludeSelf = true; ++ + }; + + // Finds chat/channel members, then contacts, then global search results. diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp -index b5823b308..a474436e1 100644 +index b5823b308..9e11fa53e 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 @@ -37,7 +70,7 @@ index b5823b308..a474436e1 100644 peer, std::move(callback)); } -@@ -50,18 +47,18 @@ void ShowSearchFromBox( +@@ -50,18 +47,20 @@ void ShowSearchFromBox( } SearchFromController::SearchFromController( @@ -49,10 +82,13 @@ index b5823b308..a474436e1 100644 +: AddSpecialBoxController( peer, - ParticipantsBoxController::Role::Members) +-, _callback(std::move(callback)) { + ParticipantsBoxController::Role::Members, + AdminDoneCallback(), + BannedDoneCallback()) - , _callback(std::move(callback)) { ++, _callback(std::move(callback)) ++{ ++ _excludeSelf = false; } void SearchFromController::prepare() { |