Allow to search messages with empty query and non-empty filter.

GitOrigin-RevId: bf8e2a0ab5dc2c48b3760ec595e6d22e9da965a5
This commit is contained in:
levlam 2020-08-21 21:21:52 +03:00
parent 552a0550c2
commit f28373a71f

View File

@ -19270,11 +19270,6 @@ std::pair<int32, vector<FullMessageId>> MessagesManager::search_messages(
return {}; return {};
} }
if (query.empty()) {
promise.set_value(Unit());
return {};
}
auto filter_type = get_search_messages_filter(filter); auto filter_type = get_search_messages_filter(filter);
if (filter_type == SearchMessagesFilter::Call || filter_type == SearchMessagesFilter::MissedCall || if (filter_type == SearchMessagesFilter::Call || filter_type == SearchMessagesFilter::MissedCall ||
filter_type == SearchMessagesFilter::Mention || filter_type == SearchMessagesFilter::UnreadMention || filter_type == SearchMessagesFilter::Mention || filter_type == SearchMessagesFilter::UnreadMention ||
@ -19283,6 +19278,11 @@ std::pair<int32, vector<FullMessageId>> MessagesManager::search_messages(
return {}; return {};
} }
if (query.empty() && filter_type == SearchMessagesFilter::Empty) {
promise.set_value(Unit());
return {};
}
do { do {
random_id = Random::secure_int64(); random_id = Random::secure_int64();
} while (random_id == 0 || found_messages_.find(random_id) != found_messages_.end()); } while (random_id == 0 || found_messages_.find(random_id) != found_messages_.end());