2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Allow searching for messages by a user who has left a chat (#6417)

Fixes #5667
This commit is contained in:
Sameer Hoosen
2019-09-09 09:05:29 +02:00
committed by John Preston
parent eebcdb842d
commit f979df3dfe
5 changed files with 19 additions and 17 deletions

View File

@@ -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 = [&] {
switch (_role) {
case Role::Members:
return tr::lng_profile_participants_section();
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));

View File

@@ -131,6 +131,9 @@ private:
AdminDoneCallback _adminDoneCallback;
BannedDoneCallback _bannedDoneCallback;
protected:
bool _excludeSelf = true;
};
// Finds chat/channel members, then contacts, then global search results.