feat(search): support from:username with no body text

Typing "from:jared" with no additional text now shows all cached
messages from that user across all rooms.

- SearchInput: call onSearch() even when only from: tokens were
  extracted (no remaining body text), passing an empty string term
- useLocalMessageSearch: introduce senderOnlyMode (empty term +
  senders set) which searches ALL rooms instead of encrypted-only,
  and skips text matching — just filters by sender
- MessageSearch: define hasActiveSearch / senderOnlyMode flags;
  use them to enable local search and fix placeholder/loading/results
  conditions; adapt local results section header and description

Server-side search is skipped in sender-only mode (Matrix search API
requires a search_term); results come from the local event cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 00:16:24 -04:00
parent 6f9bdc4d50
commit 9c690fbdfb
3 changed files with 96 additions and 61 deletions
@@ -158,7 +158,10 @@ export function SearchInput({
searchInputRef.current.value = searchTerm ?? '';
}
if (searchTerm) onSearch(searchTerm);
// Always trigger search when senders were extracted, even with no body text
if (fromMatches.length > 0 || searchTerm) {
onSearch(searchTerm ?? '');
}
closeAutocomplete();
};