mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-05 00:14:18 +00:00
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:
@@ -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}');
|
||||
});
|
||||
|
||||
@@ -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 })}</>;
|
||||
|
||||
Reference in New Issue
Block a user