fix: leave a server's own all mailbox out of all mail and unread (bulwarkmail/webmail#1241)

This commit is contained in:
Linus Rath
2026-10-31 04:41:02 +01:00
parent 6715df7f44
commit 43bb5e474a
2 changed files with 16 additions and 3 deletions
@@ -45,6 +45,15 @@ describe('buildFilter (aggregated views)', () => {
});
});
describe("buildFilter: a server's own all mailbox (bulwarkmail/webmail#1241)", () => {
it('is left out of All mail and Unread', () => {
const withAll = [...MAILBOXES, mailbox('every', 'all')];
expect(buildFilter(withAll, { view: 'all' })).toEqual({
operator: 'OR', conditions: [{ inMailbox: 'in' }, { inMailbox: 'projects' }],
});
});
});
describe('buildFilter: searching from All mail', () => {
const all = [...MAILBOXES, mailbox('arch', 'archive'), mailbox('drafts', 'drafts'), mailbox('spam', 'junk')];
+7 -3
View File
@@ -21,7 +21,7 @@ import { LIST_AUTH_RESULTS_PROPERTY } from '../lib/email-headers';
const EMAIL_LIST_PROPERTIES = [
'id', 'threadId', 'mailboxIds', 'keywords', 'size',
'receivedAt', 'from', 'to', 'cc', 'subject', 'preview', 'hasAttachment',
'receivedAt', 'from', 'to', 'cc', 'subject', 'preview', 'hasAttachment', 'sentAt',
// The sender check, for the warning shield on a forged From (#1439).
LIST_AUTH_RESULTS_PROPERTY,
];
@@ -32,9 +32,13 @@ const MAILBOX_CACHE_TTL_MS = 60 * 1000;
export type UnifiedRole = 'inbox' | 'sent' | 'drafts' | 'junk' | 'archive' | 'trash';
export type CrossView = 'all' | 'unread' | 'starred';
/** Roles left out of the cross-account All mail / Unread / Starred views. */
/**
* Roles left out of the cross-account All mail / Unread / Starred views. A
* server's own "all" mailbox holds every message again, so listing it beside
* the real folders doubled them (webmail lib/jmap/types.ts, #1241).
*/
export const CROSS_EXCLUDED_ROLES: ReadonlySet<string> = new Set([
'junk', 'spam', 'sent', 'archive', 'trash', 'drafts',
'junk', 'spam', 'sent', 'archive', 'trash', 'drafts', 'all',
]);
export interface UnifiedEmail extends Email {