mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Add archived results in chats search.
This commit is contained in:
@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "history/history.h"
|
||||
#include "dialogs/dialogs_indexed_list.h"
|
||||
#include "auth_session.h"
|
||||
@@ -1060,7 +1061,6 @@ void AddSpecialBoxSearchController::addChatsContacts() {
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const auto getSmallestIndex = [&](not_null<Dialogs::IndexedList*> list)
|
||||
-> const Dialogs::List* {
|
||||
if (list->empty()) {
|
||||
@@ -1079,17 +1079,12 @@ void AddSpecialBoxSearchController::addChatsContacts() {
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const auto dialogsIndex = getSmallestIndex(
|
||||
_peer->owner().chatsList()->indexed());
|
||||
const auto contactsIndex = getSmallestIndex(
|
||||
_peer->owner().contactsNoChatsList());
|
||||
|
||||
const auto filterAndAppend = [&](const Dialogs::List *list) {
|
||||
if (!list) {
|
||||
const auto filterAndAppend = [&](not_null<Dialogs::IndexedList*> list) {
|
||||
const auto index = getSmallestIndex(list);
|
||||
if (!index) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto row : *list) {
|
||||
for (const auto row : *index) {
|
||||
if (const auto history = row->history()) {
|
||||
if (const auto user = history->peer->asUser()) {
|
||||
if (allWordsAreFound(user->nameWords())) {
|
||||
@@ -1099,7 +1094,11 @@ void AddSpecialBoxSearchController::addChatsContacts() {
|
||||
}
|
||||
}
|
||||
};
|
||||
filterAndAppend(dialogsIndex);
|
||||
filterAndAppend(contactsIndex);
|
||||
filterAndAppend(_peer->owner().chatsList()->indexed());
|
||||
const auto id = Data::Folder::kId;
|
||||
if (const auto folder = _peer->owner().folderLoaded(id)) {
|
||||
filterAndAppend(folder->chatsList()->indexed());
|
||||
}
|
||||
filterAndAppend(_peer->owner().contactsNoChatsList());
|
||||
delegate()->peerListSearchRefreshRows();
|
||||
}
|
||||
|
Reference in New Issue
Block a user