1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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();
|