Fix empty query migrated group search.

This commit is contained in:
John Preston 2025-05-08 10:53:23 +04:00
parent 67a666b282
commit ec45041a66

View file

@ -2520,7 +2520,19 @@ bool Widget::search(bool inCache, SearchRequestDelay delay) {
}; };
if (trimmed.isEmpty() && !fromPeer && inTags.empty()) { if (trimmed.isEmpty() && !fromPeer && inTags.empty()) {
cancelSearchRequest(); cancelSearchRequest();
// Otherwise inside first searchApplyEmpty we call searchMode(),
// which tries to load migrated search results for empty query.
_migratedProcess.full = true;
searchApplyEmpty(fromStartType, currentSearchProcess()); searchApplyEmpty(fromStartType, currentSearchProcess());
if (_searchInMigrated) {
const auto type = SearchRequestType{
.migrated = true,
.start = true,
};
searchApplyEmpty(type, &_migratedProcess);
}
if (_searchWithPostsPreview) { if (_searchWithPostsPreview) {
searchApplyEmpty( searchApplyEmpty(
{ .posts = true, .start = true }, { .posts = true, .start = true },
@ -3481,7 +3493,9 @@ bool Widget::applySearchState(SearchState state) {
: ChatSearchTab::MyMessages; : ChatSearchTab::MyMessages;
} }
const auto migrateFrom = (peer && !topic) const auto migrateFrom = (peer
&& !topic
&& state.tab == ChatSearchTab::ThisPeer)
? peer->migrateFrom() ? peer->migrateFrom()
: nullptr; : nullptr;
_searchInMigrated = migrateFrom _searchInMigrated = migrateFrom