From ad1f053f72672c3e714f596617d2a5b5be433d2d Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 24 Sep 2026 19:38:48 +0200 Subject: [PATCH] fix: offer archiving in the viewer for a folder named Archive without the role --- src/screens/EmailThreadScreen.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/screens/EmailThreadScreen.tsx b/src/screens/EmailThreadScreen.tsx index c4dcbb65..4cfca3d5 100644 --- a/src/screens/EmailThreadScreen.tsx +++ b/src/screens/EmailThreadScreen.tsx @@ -37,7 +37,9 @@ import { shareEmailEml } from '../lib/email-export'; import { useKeywordsStore, keywordToken, type KeywordDef } from '../stores/keywords-store'; import { useSheetDrag } from '../lib/use-sheet-drag'; import { useLocaleStore } from '../stores/locale-store'; -import { findTrashMailbox, mailboxAccountId, mailboxesOfAccount, mailboxOfEmail } from '../lib/mailbox-tree'; +import { + findArchiveMailbox, findTrashMailbox, mailboxAccountId, mailboxesOfAccount, mailboxOfEmail, +} from '../lib/mailbox-tree'; import { pickEmailBody, plainTextBody } from '../lib/email-body'; import { singleLine } from '../lib/single-line'; import { buildForwardAsAttachmentPayload } from '../lib/forward-as-attachment'; @@ -321,8 +323,10 @@ export default function EmailThreadScreen({ route, navigation }: Props) { () => mailboxesOfAccount(mailboxes, ownerAccountId), [mailboxes, ownerAccountId], ); + // The store's rule (role, else a folder named exactly "Archive"), so the + // button is offered exactly when the archive action can file the message. const archiveMailbox = React.useMemo( - () => scopedMailboxes.find((m) => m.role === 'archive'), + () => findArchiveMailbox(scopedMailboxes), [scopedMailboxes], ); const junkMailbox = React.useMemo(