From 763732fdc9f86ed7155e419bae7239edf99b56ca Mon Sep 17 00:00:00 2001
From: Linus Rath <139418639+rathlinus@users.noreply.github.com>
Date: Tue, 29 Sep 2026 19:52:39 +0200
Subject: [PATCH] feat: leave spam and trash out of search by default
---
components/mail/mail-app.tsx | 20 ++--
.../unified-mailbox-search-accounts.test.ts | 47 ++++++++
lib/demo/demo-client.ts | 23 ++--
lib/global-search/__tests__/providers.test.ts | 3 +-
lib/global-search/providers/mail.ts | 26 +----
lib/jmap/search-utils.ts | 12 +++
lib/search-scope-folders.ts | 16 +++
lib/unified-mailbox.ts | 49 ++++++++-
locales/ar/common.json | 1 +
locales/ca/common.json | 1 +
locales/cs/common.json | 1 +
locales/da/common.json | 1 +
locales/de/common.json | 1 +
locales/en/common.json | 1 +
locales/es/common.json | 1 +
locales/fa/common.json | 1 +
locales/fr/common.json | 1 +
locales/he/common.json | 1 +
locales/hu/common.json | 1 +
locales/it/common.json | 1 +
locales/ja/common.json | 1 +
locales/ko/common.json | 1 +
locales/lv/common.json | 1 +
locales/mn/common.json | 1 +
locales/nb/common.json | 1 +
locales/nl/common.json | 1 +
locales/pl/common.json | 1 +
locales/pt/common.json | 1 +
locales/ro/common.json | 1 +
locales/ru/common.json | 1 +
locales/sk/common.json | 1 +
locales/tr/common.json | 1 +
locales/uk/common.json | 1 +
locales/zh-TW/common.json | 1 +
locales/zh/common.json | 1 +
.../email-store-search-accounts.test.ts | 100 ++++++++++++++++++
.../email-store-search-hit-account.test.ts | 5 +-
stores/email-store.ts | 63 ++++++-----
38 files changed, 320 insertions(+), 71 deletions(-)
diff --git a/components/mail/mail-app.tsx b/components/mail/mail-app.tsx
index df2c339f0..8f92728df 100644
--- a/components/mail/mail-app.tsx
+++ b/components/mail/mail-app.tsx
@@ -32,7 +32,7 @@ import type { UnifiedAccountClient } from "@/lib/unified-mailbox";
import { connectedAccountsGrew } from "@/lib/unified-mailbox";
import { KeyboardShortcutsModal } from "@/components/keyboard-shortcuts-modal";
import { useEmailStore, buildUnifiedAccountClients, captureViewToken, ArchiveMailboxNotFoundError, findArchiveMailbox, resolveUnstampedEmailAccountId } from "@/stores/email-store";
-import { groupSearchScopeFolders } from "@/lib/search-scope-folders";
+import { groupSearchScopeFolders, SEARCH_SCOPE_ALL_FOLDERS } from "@/lib/search-scope-folders";
import { toast } from "@/stores/toast-store";
import { runBatchEmailAction } from "@/lib/email-action-toast";
import { MailboxShareDialog } from "@/components/layout/mailbox-share-dialog";
@@ -4006,13 +4006,14 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
{/* Folder selector. Scopes the search only - it does not
- navigate the mail list, so it defaults to "All folders"
- regardless of which folder is open and keeps whatever
- the user picked. "All folders" spans the own AND the
- group/shared accounts' folders (#1082); the shared
- ones are listed under their owner. The unified views
- already search across every account's folders, so it
- is hidden there. */}
+ navigate the mail list, so it defaults to "All folders
+ except Spam and Trash" regardless of which folder is
+ open and keeps whatever the user picked. Both
+ folder-less scopes span the own AND the group/shared
+ accounts' folders (#1082); "All folders" also searches
+ Trash and Junk. The shared folders are listed under
+ their owner. The unified views already search across
+ every account's folders, so it is hidden there. */}
{!isUnifiedView && (
@@ -4026,7 +4027,8 @@ export function MailApp({ linkSegments: routeSegments }: MailAppProps = {}) {
}}
className="w-full h-8 text-sm rounded-md border border-input bg-background px-3 text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1"
>
-
+
+
{searchScopeFolders.own.map((mb) => (