domma-cms 1.78.0 → 1.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/admin/js/templates/docs/usage-site-settings.html +29 -1
- package/docs/DommaFeatures.md +62 -54
- package/docs/plans/2026-11-19-brand-kit-design.md +58 -0
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/attach-arrange.js +303 -0
- package/plugins/_lib/admin/mail/body-menu.js +1 -1
- package/plugins/_lib/admin/mail/cms-attach.js +340 -0
- package/plugins/_lib/admin/mail/cms-host.js +10 -3
- package/plugins/_lib/admin/mail/compose-window.js +47 -1
- package/plugins/_lib/admin/mail/contacts.js +1 -1
- package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
- package/plugins/_lib/admin/mail/drag-drop.js +33 -1
- package/plugins/_lib/admin/mail/folder-tree.js +1 -1
- package/plugins/_lib/admin/mail/font-controls.js +1 -1
- package/plugins/_lib/admin/mail/fonts.js +1 -1
- package/plugins/_lib/admin/mail/host-context.js +1 -1
- package/plugins/_lib/admin/mail/identity.js +1 -1
- package/plugins/_lib/admin/mail/image-senders-section.js +1 -1
- package/plugins/_lib/admin/mail/keyboard.js +1 -1
- package/plugins/_lib/admin/mail/mail.html +1 -1
- package/plugins/_lib/admin/mail/message-actions.js +1 -1
- package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
- package/plugins/_lib/admin/mail/panes.js +1 -1
- package/plugins/_lib/admin/mail/reader-kit.js +1 -1
- package/plugins/_lib/admin/mail/reader-runtime.js +119 -63
- package/plugins/_lib/admin/mail/reader-view.js +1 -1
- package/plugins/_lib/admin/mail/resizable.js +1 -1
- package/plugins/_lib/admin/mail/restore-spam.js +1 -1
- package/plugins/_lib/admin/mail/rules.js +1 -1
- package/plugins/_lib/admin/mail/scheduling.js +1 -1
- package/plugins/_lib/admin/mail/section-kit.js +1 -1
- package/plugins/_lib/admin/mail/security-note.js +1 -1
- package/plugins/_lib/admin/mail/settings-section.js +6 -3
- package/plugins/_lib/admin/mail/templates.js +1 -1
- package/plugins/_lib/admin/mail/threads.js +1 -1
- package/plugins/_lib/admin/mail/vacation.js +1 -1
- package/plugins/_lib/admin/mail/when-closed.js +1 -1
- package/plugins/_lib/admin/ui/dates.js +1 -1
- package/plugins/_lib/admin/ui/resizable.js +1 -1
- package/plugins/_lib/admin/ui/rich-field.js +1 -1
- package/plugins/_lib/domma-mail.lock.json +85 -83
- package/plugins/_lib/mail/accountFileStore.js +1 -1
- package/plugins/_lib/mail/accountRepository.js +41 -2
- package/plugins/_lib/mail/accountRoutes.js +1 -1
- package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
- package/plugins/_lib/mail/bodyTokens.js +1 -1
- package/plugins/_lib/mail/compose.js +1 -1
- package/plugins/_lib/mail/defaults.js +1 -1
- package/plugins/_lib/mail/envelope.js +1 -1
- package/plugins/_lib/mail/folderActions.js +1 -1
- package/plugins/_lib/mail/folderRuntime.js +1 -1
- package/plugins/_lib/mail/folders.js +1 -1
- package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
- package/plugins/_lib/mail/mbox.js +1 -1
- package/plugins/_lib/mail/message-action.js +1 -1
- package/plugins/_lib/mail/messageSecurity.js +1 -1
- package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
- package/plugins/_lib/mail/networkAddresses.js +1 -1
- package/plugins/_lib/mail/networkPolicy.js +1 -1
- package/plugins/_lib/mail/oauthAccounts.js +1 -1
- package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
- package/plugins/_lib/mail/oauthRuntime.js +1 -1
- package/plugins/_lib/mail/pollSchedule.js +1 -1
- package/plugins/_lib/mail/poller.js +1 -1
- package/plugins/_lib/mail/pollerRuntime.js +1 -1
- package/plugins/_lib/mail/priority.js +1 -1
- package/plugins/_lib/mail/publicMailbox.js +1 -1
- package/plugins/_lib/mail/readRuntime.js +1 -1
- package/plugins/_lib/mail/render.js +1 -1
- package/plugins/_lib/mail/ruleRunner.js +1 -1
- package/plugins/_lib/mail/schedulerRuntime.js +1 -1
- package/plugins/_lib/mail/secretProvider.js +1 -1
- package/plugins/_lib/mail/secretbox.js +1 -1
- package/plugins/_lib/mail/senderAuth.js +1 -1
- package/plugins/_lib/mail/sieve.js +1 -1
- package/plugins/_lib/mail/smtpService.js +1 -1
- package/plugins/_lib/mail/snoozeRuntime.js +1 -1
- package/plugins/_lib/mail/store.js +1 -1
- package/plugins/_lib/mail/subscriptions.js +1 -1
- package/plugins/_lib/mail/syncPlan.js +1 -1
- package/plugins/_lib/mail/syncRuntime.js +1 -1
- package/plugins/_lib/mail/syncSelection.js +1 -1
- package/plugins/_lib/mail/unreadBadge.js +1 -1
- package/plugins/_lib/mail/unsubscribe.js +1 -1
- package/plugins/_lib/mail/vacationRuntime.js +1 -1
- package/plugins/_lib/mail/write.js +1 -1
- package/plugins/_lib/public/rich-text.mjs +1 -1
- package/plugins/_lib/rich-text.js +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/cms-host.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** The CMS shell boundary. Standalone never imports this adapter. */
|
|
4
4
|
const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
@@ -14,9 +14,16 @@ const [toolKit, help, loading, chrome, mailCompose, notifications, smoothCaret]
|
|
|
14
14
|
import('/admin/js/lib/smooth-caret.js').catch(() => ({}))
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
|
+
const {createCmsAttachmentSources} = await import(new URL(`./cms-attach.js?v=${version}`, import.meta.url).href);
|
|
18
|
+
|
|
17
19
|
export function createCmsMailHost({pluginName}) {
|
|
18
|
-
|
|
20
|
+
// The compose window asks for these when it opens; they need the finished host to make their requests.
|
|
21
|
+
let sources = async () => [];
|
|
22
|
+
const host = createMailHost({
|
|
19
23
|
pluginName, framework: globalThis.Domma, storage: globalThis.S,
|
|
20
|
-
helpers: {...toolKit, ...help, loading, chrome, mailCompose, notifications, ...smoothCaret}
|
|
24
|
+
helpers: {...toolKit, ...help, loading, chrome, mailCompose, notifications, ...smoothCaret},
|
|
25
|
+
attachmentSources: () => sources()
|
|
21
26
|
});
|
|
27
|
+
sources = createCmsAttachmentSources(host);
|
|
28
|
+
return host;
|
|
22
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/compose-window.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
@@ -11,6 +11,7 @@ const {makeResizable} = await import(new URL(`./resizable.js?v=${MAIL_MODULE_VER
|
|
|
11
11
|
const {whenClosed} = await import(new URL(`./when-closed.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
12
12
|
const {esc} = await import(new URL(`./reader-kit.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
13
13
|
const {installFontControls} = await import(new URL(`./font-controls.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
14
|
+
const {cleanLinks, cleanPicked, cleanSources, linkBlock, placeBlock, placeText} = await import(new URL(`./attach-arrange.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
14
15
|
const {
|
|
15
16
|
collectGroups,
|
|
16
17
|
currentFragment,
|
|
@@ -310,6 +311,7 @@ export function createComposeWindow(mailHost) {
|
|
|
310
311
|
</div>
|
|
311
312
|
<div class="flex items-center gap-2 flex-wrap">
|
|
312
313
|
<button type="button" class="btn btn-sm btn-ghost" data-on-click="pickFiles">Attach files</button>
|
|
314
|
+
<span class="mail-attach-sources flex items-center gap-2 flex-wrap" data-ref="sources"></span>
|
|
313
315
|
<span data-bind-class="attachTone.value" data-bind-text="attachSummary.value"></span>
|
|
314
316
|
<span data-help-title="Attachments" data-help="The running total is shown as you add files, and turns red over this mailbox's limit - a message that large cannot be sent. Right-click a file (or use its ⋮, or Shift+F10) to remove it."></span>
|
|
315
317
|
</div>
|
|
@@ -384,6 +386,7 @@ export function createComposeWindow(mailHost) {
|
|
|
384
386
|
const picker = ref('template');
|
|
385
387
|
const editorHost = ref('editor');
|
|
386
388
|
const fileInput = ref('files');
|
|
389
|
+
const sourcesBox = ref('sources');
|
|
387
390
|
|
|
388
391
|
// ---- View state ------------------------------------------------------
|
|
389
392
|
|
|
@@ -660,6 +663,49 @@ export function createComposeWindow(mailHost) {
|
|
|
660
663
|
if (added.length) attachments.value = [...attachments.peek(), ...added];
|
|
661
664
|
});
|
|
662
665
|
|
|
666
|
+
// Other places to attach from, when the host offers any (in the CMS: Media and the File Store). Each
|
|
667
|
+
// source opens its own chooser; what it hands back is checked (attach-arrange.js) before it is attached.
|
|
668
|
+
Promise.resolve().then(() => (typeof mailHost.attachmentSources === 'function' ? mailHost.attachmentSources() : mailHost.attachmentSources))
|
|
669
|
+
.then((list) => {
|
|
670
|
+
for (const source of cleanSources(list)) {
|
|
671
|
+
const button = document.createElement('button');
|
|
672
|
+
button.type = 'button';
|
|
673
|
+
button.className = 'btn btn-sm btn-ghost';
|
|
674
|
+
button.textContent = source.label;
|
|
675
|
+
button.title = source.title;
|
|
676
|
+
button.dataset.attachSource = source.id;
|
|
677
|
+
button.addEventListener('click', async () => {
|
|
678
|
+
if (button.disabled) return;
|
|
679
|
+
button.disabled = true;
|
|
680
|
+
try {
|
|
681
|
+
const used = attachments.peek().reduce((n, a) => n + a.bytes, 0);
|
|
682
|
+
const handed = await source.pick({remainingBytes: Math.max(0, maxAttachmentBytes - used)});
|
|
683
|
+
// A source hands back files to attach, or {attachments, links}: links go into the message itself.
|
|
684
|
+
const files = Array.isArray(handed) ? handed : handed?.attachments;
|
|
685
|
+
const picked = cleanPicked(files);
|
|
686
|
+
if (picked.length) attachments.value = [...attachments.peek(), ...picked.map(file => ({key: `a${nextKey++}`, ...file}))];
|
|
687
|
+
const offered = Array.isArray(handed) || !Array.isArray(handed?.links) ? [] : handed.links;
|
|
688
|
+
const links = cleanLinks(offered);
|
|
689
|
+
if (links.length) {
|
|
690
|
+
const block = linkBlock(links, {expiresAt: handed.expiresAt});
|
|
691
|
+
if (editor) editor.setValue(placeBlock(editor.getValue(), block.html));
|
|
692
|
+
else bodyInput.value = placeText(bodyInput.value, block.text);
|
|
693
|
+
E.toast(`${links.length === 1 ? 'A link was' : `${links.length} links were`} put in the message.`, {type: 'success'});
|
|
694
|
+
}
|
|
695
|
+
// Never dropped without a word: what could not be attached is said.
|
|
696
|
+
const lost = (Array.isArray(files) ? files.length : 0) - picked.length + (offered.length - links.length);
|
|
697
|
+
if (lost > 0) E.toast(`${lost} file${lost === 1 ? '' : 's'} could not be ${offered.length ? 'added' : 'attached'}.`, {type: 'warning'});
|
|
698
|
+
} catch (err) {
|
|
699
|
+
E.toast(err?.message || 'Those files could not be attached.', {type: 'error'});
|
|
700
|
+
} finally {
|
|
701
|
+
button.disabled = false;
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
sourcesBox?.appendChild(button);
|
|
705
|
+
}
|
|
706
|
+
})
|
|
707
|
+
.catch(() => { /* a host whose sources fail still has "Attach files" */ });
|
|
708
|
+
|
|
663
709
|
/** @param {string} key */
|
|
664
710
|
function removeAttachment(key) {
|
|
665
711
|
attachments.value = attachments.peek().filter(a => a.key !== key);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/contacts.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Recipient suggestions from the host address book.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/diagnostics-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The settings section that answers "which build is this, and what went wrong".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/drag-drop.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Drag identities include the mailbox and source folder: UIDs alone are not unique. */
|
|
4
4
|
const PROTECTED_USES = new Set(['\\Inbox', '\\Sent', '\\Drafts', '\\Trash', '\\Junk', '\\Archive', '\\All', '\\Flagged']);
|
|
@@ -44,3 +44,35 @@ export function messageMoveBatches(drag, destination) {
|
|
|
44
44
|
return batches;
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The ticked rows as batches per folder they live in: search results span folders, and a UID is only a message
|
|
50
|
+
* within its own folder. A ticked UID no longer on the page goes with the open folder, as it always did.
|
|
51
|
+
*
|
|
52
|
+
* @param {Set<number>} selected
|
|
53
|
+
* @param {{uid: number, folder?: string}[]} messages
|
|
54
|
+
* @param {string} currentFolder
|
|
55
|
+
* @param {number} [size] - UIDs per request
|
|
56
|
+
* @returns {{folder: string, uids: number[]}[]}
|
|
57
|
+
*/
|
|
58
|
+
export function selectionBatches(selected, messages, currentFolder, size = 500) {
|
|
59
|
+
const groups = new Map();
|
|
60
|
+
const add = (folder, uid) => {
|
|
61
|
+
if (!folder || !Number.isInteger(uid) || uid < 1) return;
|
|
62
|
+
if (!groups.has(folder)) groups.set(folder, new Set());
|
|
63
|
+
groups.get(folder).add(uid);
|
|
64
|
+
};
|
|
65
|
+
const seen = new Set();
|
|
66
|
+
for (const row of messages ?? []) {
|
|
67
|
+
if (!selected.has(row.uid)) continue;
|
|
68
|
+
seen.add(row.uid);
|
|
69
|
+
add(row.folder ?? currentFolder, row.uid);
|
|
70
|
+
}
|
|
71
|
+
for (const uid of selected) if (!seen.has(uid)) add(currentFolder, uid);
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const [folder, uids] of groups) {
|
|
74
|
+
const list = [...uids];
|
|
75
|
+
for (let at = 0; at < list.length; at += size) out.push({folder, uids: list.slice(at, at + size)});
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/folder-tree.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Mail folder presentation, shared by the Mail Reader and Email Pro.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/font-controls.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/fonts.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The fonts and sizes the mail editor offers - pure, so both the compose
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/host-context.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Services supplied by the application that hosts the shared mail interface. */
|
|
4
4
|
export function createMailApi({getToken, fetch: request = globalThis.fetch, onUnauthorized = () => {}}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/identity.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Who a mailbox sends as, and what it signs off with.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/image-senders-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The settings section for senders whose images always load.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/keyboard.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Keyboard navigation for the reader.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/message-actions.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* What other Tools add to a message's menu - Booking's "Book Sam...".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/oauth-panel.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* "Sign in with Microsoft / Google" for a mailbox - the part of the mailbox
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/panes.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Pane sizing for the mail reader, shared by the Mail Reader and Email Pro.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/reader-kit.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The reader view's decisions that need no DOM - escaping, the mailbox form's
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/reader-runtime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
const {createMailHost} = await import(new URL(`./host-context.js?v=${MAIL_MODULE_VERSION}`, import.meta.url).href);
|
|
@@ -45,7 +45,7 @@ const {
|
|
|
45
45
|
unreadInSubtree
|
|
46
46
|
} = await import(versioned('folder-tree.js'));
|
|
47
47
|
const {imageSendersSection} = await import(versioned('image-senders-section.js'));
|
|
48
|
-
const {messageDrag, canDragFolder, acceptsMailDrop, messageMoveBatches} = await import(versioned('drag-drop.js'));
|
|
48
|
+
const {messageDrag, canDragFolder, acceptsMailDrop, messageMoveBatches, selectionBatches} = await import(versioned('drag-drop.js'));
|
|
49
49
|
const {
|
|
50
50
|
createSettingsSection, READ_DELAY_KEY, readDelaySeconds, scheduleMarkRead, readComposePrefs,
|
|
51
51
|
PAGE_SIZE_KEY, PAGE_SIZES, listPageSize, pageAfterResize
|
|
@@ -3323,30 +3323,56 @@ return {
|
|
|
3323
3323
|
}
|
|
3324
3324
|
|
|
3325
3325
|
/**
|
|
3326
|
-
*
|
|
3326
|
+
* After a bulk action: the folder counts and the list again, as the server now has them, with the same
|
|
3327
|
+
* search, page and view - so rows that no longer match the search drop out and the next ones move up,
|
|
3328
|
+
* rather than the page shrinking until it is reopened.
|
|
3329
|
+
*
|
|
3330
|
+
* @param {string} account - the mailbox the action was on
|
|
3331
|
+
* @returns {Promise<void>}
|
|
3332
|
+
*/
|
|
3333
|
+
async function reloadAfterBulk(account) {
|
|
3334
|
+
if (!here() || currentAccountId !== account) return;
|
|
3335
|
+
// refreshFolders reloads the list itself, except in a search.
|
|
3336
|
+
await refreshFolders();
|
|
3337
|
+
if (!here() || currentAccountId !== account) return;
|
|
3338
|
+
if (searchQuery) await loadMessages({fresh: true, quiet: true});
|
|
3339
|
+
const pages = Math.max(1, Math.ceil(total / (limit || pageSize)));
|
|
3340
|
+
if (page > pages) {
|
|
3341
|
+
page = pages;
|
|
3342
|
+
await loadMessages({fresh: true, quiet: true});
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3346
|
+
/** The row a bulk result is about: its UID in that folder. */
|
|
3347
|
+
const rowIn = (folder, uid) => messages.find(m => m.uid === uid && (m.folder ?? currentFolder) === folder);
|
|
3348
|
+
|
|
3349
|
+
/**
|
|
3350
|
+
* Flag everything selected: one request per folder the rows live in.
|
|
3327
3351
|
*
|
|
3328
3352
|
* @param {{add?: string[], remove?: string[]}} change
|
|
3329
3353
|
* @returns {Promise<void>}
|
|
3330
3354
|
*/
|
|
3331
3355
|
async function bulkFlags(change) {
|
|
3332
|
-
const
|
|
3333
|
-
const
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3356
|
+
const account = currentAccountId;
|
|
3357
|
+
const batches = selectionBatches(selected, messages, currentFolder);
|
|
3358
|
+
let failure = null;
|
|
3359
|
+
try {
|
|
3360
|
+
for (const batch of batches) {
|
|
3361
|
+
const params = new URLSearchParams({account: account ?? '', folder: batch.folder});
|
|
3362
|
+
const result = await api(`${BASE}/messages/flags?${params}`, 'POST', {uids: batch.uids, ...change});
|
|
3363
|
+
for (const {uid, flags} of result.updated ?? []) {
|
|
3364
|
+
const row = rowIn(batch.folder, uid);
|
|
3365
|
+
if (!row) continue;
|
|
3366
|
+
row.flags = flags;
|
|
3367
|
+
row.seen = flags.includes('\\Seen');
|
|
3368
|
+
row.flagged = flags.includes('\\Flagged');
|
|
3369
|
+
row.flags$ ? (row.flags$.value = flags) : null;
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
} catch (err) { failure = err; }
|
|
3349
3373
|
clearSelection();
|
|
3374
|
+
await reloadAfterBulk(account);
|
|
3375
|
+
if (failure) throw failure;
|
|
3350
3376
|
}
|
|
3351
3377
|
|
|
3352
3378
|
/**
|
|
@@ -3356,29 +3382,40 @@ return {
|
|
|
3356
3382
|
* @returns {Promise<void>}
|
|
3357
3383
|
*/
|
|
3358
3384
|
async function bulkSpam(spam) {
|
|
3359
|
-
const uids = [...selected];
|
|
3360
|
-
const source = currentFolder;
|
|
3361
3385
|
const account = currentAccountId;
|
|
3362
|
-
const
|
|
3363
|
-
const
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
for (const
|
|
3367
|
-
|
|
3368
|
-
|
|
3386
|
+
const batches = selectionBatches(selected, messages, currentFolder);
|
|
3387
|
+
const undo = [];
|
|
3388
|
+
let count = 0, movedTo = null, undoable = true, failure = null;
|
|
3389
|
+
try {
|
|
3390
|
+
for (const batch of batches) {
|
|
3391
|
+
const params = new URLSearchParams({account: account ?? '', folder: batch.folder});
|
|
3392
|
+
const result = await api(`${BASE}/messages/spam?${params}`, 'POST', {uids: batch.uids, spam});
|
|
3393
|
+
count += result.count ?? batch.uids.length;
|
|
3394
|
+
if (!result.movedTo) continue;
|
|
3395
|
+
movedTo = result.movedTo;
|
|
3396
|
+
for (const uid of batch.uids) if (rowIn(batch.folder, uid)) removeFromList(uid);
|
|
3397
|
+
const mapped = Object.values(result.uidMap ?? {});
|
|
3398
|
+
if (mapped.length) undo.push({from: result.movedTo, destination: batch.folder, uids: mapped});
|
|
3399
|
+
else undoable = false;
|
|
3400
|
+
}
|
|
3401
|
+
} catch (err) { failure = err; }
|
|
3402
|
+
clearSelection();
|
|
3403
|
+
await reloadAfterBulk(account);
|
|
3404
|
+
if (failure) throw failure;
|
|
3405
|
+
if (!movedTo) {
|
|
3406
|
+
E.toast(`${count} marked as ${spam ? 'spam' : 'not spam'}.`, {type: 'success'});
|
|
3369
3407
|
return;
|
|
3370
3408
|
}
|
|
3371
|
-
|
|
3372
|
-
for (const uid of uids) removeFromList(uid);
|
|
3373
|
-
clearSelection();
|
|
3374
|
-
|
|
3375
|
-
const mapped = Object.values(result.uidMap ?? {});
|
|
3376
3409
|
offerUndo(
|
|
3377
|
-
`${
|
|
3378
|
-
|
|
3410
|
+
`${count} moved to ${movedTo}.`,
|
|
3411
|
+
undoable && undo.length
|
|
3379
3412
|
? async () => {
|
|
3380
|
-
|
|
3381
|
-
|
|
3413
|
+
while (undo.length) {
|
|
3414
|
+
const batch = undo[0];
|
|
3415
|
+
await restoreSpam({api, base: BASE, account, ...batch, spam: !spam});
|
|
3416
|
+
undo.shift();
|
|
3417
|
+
}
|
|
3418
|
+
await reloadAfterBulk(account);
|
|
3382
3419
|
}
|
|
3383
3420
|
: null
|
|
3384
3421
|
);
|
|
@@ -3395,34 +3432,53 @@ return {
|
|
|
3395
3432
|
}
|
|
3396
3433
|
|
|
3397
3434
|
async function bulkDelete() {
|
|
3398
|
-
const
|
|
3399
|
-
const
|
|
3400
|
-
const
|
|
3401
|
-
const
|
|
3402
|
-
|
|
3435
|
+
const account = currentAccountId;
|
|
3436
|
+
const batches = selectionBatches(selected, messages, currentFolder);
|
|
3437
|
+
const n = batches.reduce((sum, b) => sum + b.uids.length, 0);
|
|
3438
|
+
const permanent = features.confirmPermanentDelete && batches.some(b => permanentDeleteFrom(b.folder));
|
|
3439
|
+
const question = permanent ? `Permanently delete ${n} message${n === 1 ? '' : 's'} from the server? This cannot be undone.`
|
|
3440
|
+
: `Delete ${n} message${n === 1 ? '' : 's'}?`;
|
|
3403
3441
|
if (!await ask(question, {confirmText: permanent ? 'Delete permanently' : 'Delete', cancelText: 'Keep them'}) || !here()) return;
|
|
3404
|
-
const
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3442
|
+
const undo = [];
|
|
3443
|
+
let deleted = 0, expunged = 0, movedTo = null, undoable = true, failure = null;
|
|
3444
|
+
try {
|
|
3445
|
+
for (const batch of batches) {
|
|
3446
|
+
const params = new URLSearchParams({account: account ?? '', folder: batch.folder});
|
|
3447
|
+
if (features.confirmPermanentDelete && permanentDeleteFrom(batch.folder)) params.set('permanent', '1');
|
|
3448
|
+
const result = await api(`${BASE}/messages/delete?${params}`, 'POST', {uids: batch.uids});
|
|
3449
|
+
for (const uid of batch.uids) if (rowIn(batch.folder, uid)) removeFromList(uid);
|
|
3450
|
+
if (result.expunged) { expunged += result.deleted ?? batch.uids.length; continue; }
|
|
3451
|
+
deleted += result.deleted ?? batch.uids.length;
|
|
3452
|
+
movedTo = result.movedTo;
|
|
3453
|
+
const mapped = Object.values(result.uidMap ?? {});
|
|
3454
|
+
if (mapped.length) undo.push({from: result.movedTo, uids: mapped, destination: batch.folder});
|
|
3455
|
+
else undoable = false;
|
|
3456
|
+
}
|
|
3457
|
+
} catch (err) { failure = err; }
|
|
3409
3458
|
clearSelection();
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
}
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
? async () => {
|
|
3419
|
-
const back = new URLSearchParams({account: currentAccountId ?? '', folder: result.movedTo});
|
|
3420
|
-
await api(`${BASE}/messages/move?${back}`, 'POST', {uids: mapped, destination: source});
|
|
3421
|
-
await loadMessages({quiet: true});
|
|
3422
|
-
}
|
|
3423
|
-
: null
|
|
3424
|
-
);
|
|
3459
|
+
await reloadAfterBulk(account);
|
|
3460
|
+
if (failure) {
|
|
3461
|
+
E.toast(`${failure.message || 'That could not be done.'} ${deleted + expunged} deleted before the failure.`, {type: 'error'});
|
|
3462
|
+
return;
|
|
3463
|
+
}
|
|
3464
|
+
if (!deleted) {
|
|
3465
|
+
offerUndo(`${expunged} deleted from the server. This cannot be undone.`, null);
|
|
3466
|
+
return;
|
|
3425
3467
|
}
|
|
3468
|
+
offerUndo(
|
|
3469
|
+
`${deleted} moved to ${movedTo}.${expunged ? ` ${expunged} deleted from the server.` : ''}`,
|
|
3470
|
+
undoable && undo.length
|
|
3471
|
+
? async () => {
|
|
3472
|
+
while (undo.length) {
|
|
3473
|
+
const batch = undo[0];
|
|
3474
|
+
const back = new URLSearchParams({account: account ?? '', folder: batch.from});
|
|
3475
|
+
await api(`${BASE}/messages/move?${back}`, 'POST', {uids: batch.uids, destination: batch.destination});
|
|
3476
|
+
undo.shift();
|
|
3477
|
+
}
|
|
3478
|
+
await reloadAfterBulk(account);
|
|
3479
|
+
}
|
|
3480
|
+
: null
|
|
3481
|
+
);
|
|
3426
3482
|
}
|
|
3427
3483
|
|
|
3428
3484
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/reader-view.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Existing CMS entry point for the shared mail view. */
|
|
4
4
|
const version = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/resizable.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The mail reader's resizable slideovers.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/restore-spam.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Undo restores both junk status and the original folder, following each UID remap. */
|
|
4
4
|
export async function restoreSpam({api, base, account, from, destination, uids, spam}) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/scheduling.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/section-kit.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/security-note.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* What the reader says about a signed or encrypted (S/MIME) message.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/settings-section.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** Browser preferences for the shared mail reader. */
|
|
4
4
|
export const READ_DELAY_KEY = 'domma-mail.mark-read-seconds';
|
|
@@ -162,11 +162,14 @@ const SETTINGS_GUIDE = `
|
|
|
162
162
|
*/
|
|
163
163
|
export function createSettingsSection({canWrite, canSend = false, load, save, sidebarUrl = null, userId = null, host = null, renderNotificationSettings = null}) {
|
|
164
164
|
const S = host?.storage ?? globalThis.S;
|
|
165
|
+
const mailboxNoteText = host?.capabilities?.mailboxSecuritySettings === false
|
|
166
|
+
? 'Receipts, secure delivery and where replies are filed belong to each mailbox: see Composing.'
|
|
167
|
+
: 'Receipts, signing, encryption and where replies are filed belong to each mailbox: see Composing and Security.';
|
|
165
168
|
return {
|
|
166
169
|
id: 'settings',
|
|
167
170
|
label: 'Settings',
|
|
168
171
|
help: 'Preferences for reading and writing email in this browser.',
|
|
169
|
-
guide: SETTINGS_GUIDE,
|
|
172
|
+
guide: SETTINGS_GUIDE.replace(/<p>Receipts,[^<]*<\/p>/, host?.capabilities?.mailboxComposeSettings === false ? '' : `<p>${mailboxNoteText}</p>`),
|
|
170
173
|
async render(container, ctx) {
|
|
171
174
|
const kit = await import(new URL(`./section-kit.js?v=${ctx.assetVersion ?? '1'}`, import.meta.url).href);
|
|
172
175
|
const M = host?.M ?? globalThis.M;
|
|
@@ -252,7 +255,7 @@ export function createSettingsSection({canWrite, canSend = false, load, save, si
|
|
|
252
255
|
</div>
|
|
253
256
|
<label class="mail-pref-check"><input type="checkbox" data-model="spellcheck.value"> Check spelling as I type
|
|
254
257
|
<span data-help-title="Spelling" data-help="The browser's own spelling check, in the browser's language. Switch it off if it marks names and terms you use a lot."></span></label>
|
|
255
|
-
<p class="mail-pref-hint" data-bind-hidden="!mailboxNote"
|
|
258
|
+
<p class="mail-pref-hint" data-bind-hidden="!mailboxNote">${mailboxNoteText}</p>
|
|
256
259
|
</section>
|
|
257
260
|
|
|
258
261
|
<section class="mail-pref-group" aria-labelledby="mail-pref-notify" data-bind-hidden="!notify">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/templates.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
const MAIL_MODULE_VERSION = new URL(import.meta.url).searchParams.get('v') ?? '1';
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/threads.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Grouping messages into conversations.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/vacation.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The automatic reply, and everything that must stop it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/mail/when-closed.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Run code when a Domma modal or slideover actually closes.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/ui/dates.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Dates as a plugin shows them to a person: dd/mm/yyyy, and dd/mm/yyyy HH:mm
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.38.0, packages/core/src/admin/ui/rich-field.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* A Description field as a rich text editor, and a description shown in the admin.
|