fix: count conversations above grouped search results while more can load

The test for "10+ results" now runs with conversations off, the only
case that still says results.
This commit is contained in:
Linus Rath
2026-11-04 11:10:27 +01:00
parent d59a896558
commit a834960d08
2 changed files with 10 additions and 1 deletions
@@ -47,7 +47,13 @@ describe('SearchResultCount', () => {
expect(container.textContent).toBe('advanced_search.results_found {"count":10}');
});
it('keeps "10+ results" while more can load', () => {
it('counts conversations while more can load and the list groups them', () => {
const { container } = render(<SearchResultCount emails={results} hasMore />);
expect(container.textContent).toBe('email_list.conversations_count_plus {"count":3}');
});
it('keeps "10+ results" while more can load and conversations are off', () => {
useSettingsStore.setState({ disableThreading: true });
const { container } = render(<SearchResultCount emails={results} hasMore />);
expect(container.textContent).toBe('advanced_search.results_found_more {"count":10}');
});
+3
View File
@@ -18,6 +18,9 @@ export function SearchResultCount({ emails, hasMore }: { emails: Email[]; hasMor
() => (disableThreading ? emails.length : groupEmailsByThread(emails).length),
[emails, disableThreading],
);
// More to load: the rows are conversations when the list groups them, so
// "100+ results" above them reads wrong as well (mail-16).
if (hasMore && !disableThreading) return <>{t("email_list.conversations_count_plus", { count: conversations })}</>;
if (hasMore) return <>{t("advanced_search.results_found_more", { count: emails.length })}</>;
if (conversations === emails.length) return <>{t("advanced_search.results_found", { count: emails.length })}</>;
return <>{t("mail_list_extra.search_count", { conversations, messages: emails.length })}</>;