Files
native/src/lib/unified-section.ts
T
Linus Rath af6290fd4c fix: only show the unified mailbox when it can hold more than one account's mail #843
The drawer showed "All inboxes" and the Unified section as soon as a
second account was signed in, but with cross-account off the unified
views only cover the active account, so they repeated its own folders.
They now follow the webmail's rule: shown with cross-account on and
several accounts, or when group inboxes are merged in.
2026-09-24 19:36:41 +02:00

21 lines
874 B
TypeScript

/**
* Whether the drawer offers the unified mailbox (the "All inboxes" row and
* the Unified section), following the webmail's rule (#843): only when the
* unified views will hold more than the open account's own folders.
*
* - Cross-account on and a second account signed in: every account's mail.
* - Group inboxes merged in and the account has one: own plus group mail.
*
* A second account alone is not enough: with cross-account off the views
* cover only the active account, so "All inboxes" merely repeated Inbox.
*/
export function showUnifiedSection(opts: {
accountCount: number;
unifiedCrossAccount: boolean;
includeGroupInUnified: boolean;
hasSharedInbox: boolean;
}): boolean {
const crossAccountActive = opts.unifiedCrossAccount && opts.accountCount > 1;
return crossAccountActive || (opts.includeGroupInUnified && opts.hasSharedInbox);
}