mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 16:13:15 +00:00
Opening a message puts its subject in the browser-tab title. The title does
not stay in the tab strip: browsers keep it in history and in the
session-restore list, and screen shares show it. For mailboxes that hold
other people's correspondence that is a leak nobody audits.
A new feature gate, tabTitleSubjectEnabled ("Subject in Tab Title" under
Admin -> Policy), is on by default, so nothing changes for existing
installs. With it off, the title names the folder instead, so the tab still
says where you are. It is an admin gate rather than a user setting: whose
mail the boxes hold is a deployment decision.
The gate counts as off until the policy has loaded, so a subject never
slips into history while the setting is still unknown.
Refs #1159
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { formatTabTitle, mailTitleContext } from '../tab-title';
|
|
|
|
describe('formatTabTitle', () => {
|
|
it('puts the context first, the account next and the app name last', () => {
|
|
expect(formatTabTitle('Inbox (3)', 'jane@example.com', 'Acme Mail')).toBe(
|
|
'Inbox (3) - jane@example.com - Acme Mail',
|
|
);
|
|
});
|
|
|
|
it('leaves out a missing account', () => {
|
|
expect(formatTabTitle('Inbox', null, 'Acme Mail')).toBe('Inbox - Acme Mail');
|
|
expect(formatTabTitle('Inbox', '', 'Acme Mail')).toBe('Inbox - Acme Mail');
|
|
});
|
|
|
|
it('leaves out a missing context', () => {
|
|
expect(formatTabTitle(undefined, 'jane@example.com', 'Acme Mail')).toBe('jane@example.com - Acme Mail');
|
|
expect(formatTabTitle('', 'jane@example.com', 'Acme Mail')).toBe('jane@example.com - Acme Mail');
|
|
});
|
|
|
|
it('falls back to the app name alone', () => {
|
|
expect(formatTabTitle(null, null, 'Acme Mail')).toBe('Acme Mail');
|
|
});
|
|
});
|
|
|
|
describe('mailTitleContext', () => {
|
|
const view = { composer: 'Reply', subject: 'Quarterly report', mailbox: 'Inbox (3)' };
|
|
|
|
it('names the composer while it is open', () => {
|
|
expect(mailTitleContext(view)).toBe('Reply');
|
|
});
|
|
|
|
it('names the open message otherwise', () => {
|
|
expect(mailTitleContext({ ...view, composer: null })).toBe('Quarterly report');
|
|
});
|
|
|
|
it('names the mailbox when no message is open', () => {
|
|
expect(mailTitleContext({ mailbox: 'Inbox (3)' })).toBe('Inbox (3)');
|
|
});
|
|
|
|
it('has nothing to add before a mailbox is selected', () => {
|
|
expect(mailTitleContext({})).toBeNull();
|
|
});
|
|
|
|
it('names the mailbox instead of the open message when the subject is kept out', () => {
|
|
expect(mailTitleContext({ ...view, composer: null }, { showSubject: false })).toBe('Inbox (3)');
|
|
});
|
|
|
|
it('still names the composer when the subject is kept out', () => {
|
|
expect(mailTitleContext(view, { showSubject: false })).toBe('Reply');
|
|
});
|
|
});
|