From e12cfd68234ec81a5983e37c2d11bb0e7c066b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=B9i=20Trung=20Hi=E1=BA=BFu?= Date: Mon, 22 Jul 2024 12:04:07 +0700 Subject: [PATCH] TW-1923: Hide no results when search matrix ID --- lib/pages/search/search_view.dart | 4 +++- lib/pages/search/server_search_view.dart | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/pages/search/search_view.dart b/lib/pages/search/search_view.dart index e7a5c3aa19..1ef7efd115 100644 --- a/lib/pages/search/search_view.dart +++ b/lib/pages/search/search_view.dart @@ -73,8 +73,10 @@ class SearchView extends StatelessWidget { searchController.serverSearchController.searchResultsNotifier, builder: ((context, searchResults, child) { if (searchResults is PresentationServerSideEmptySearch) { + final keyword = searchController.textEditingController.text; if (searchController.searchContactAndRecentChatController! - .recentAndContactsNotifier.value.isNotEmpty) { + .recentAndContactsNotifier.value.isNotEmpty || + (keyword.isValidMatrixId && keyword.startsWith('@'))) { return child!; } return _SearchHeader( diff --git a/lib/pages/search/server_search_view.dart b/lib/pages/search/server_search_view.dart index 8be0ae054a..55add06cd0 100644 --- a/lib/pages/search/server_search_view.dart +++ b/lib/pages/search/server_search_view.dart @@ -28,11 +28,13 @@ class ServerSearchMessagesList extends StatelessWidget { searchController.serverSearchController.searchResultsNotifier, builder: (context, serverSearchNotifier, child) { if (serverSearchNotifier is PresentationServerSideEmptySearch) { + final keyword = searchController.textEditingController.text; if (searchController.searchContactAndRecentChatController! - .recentAndContactsNotifier.value.isNotEmpty) { - return const SizedBox.shrink(); + .recentAndContactsNotifier.value.isEmpty && + !(keyword.isValidMatrixId && keyword.startsWith('@'))) { + return child!; } - return child!; + return const SizedBox.shrink(); } if (serverSearchNotifier is PresentationServerSideSearch) {