domma-cms 1.33.0 → 1.35.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 +9 -0
- package/admin/js/lib/sidebar-notify.js +1 -1
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/body-menu.js +1 -1
- package/plugins/_lib/admin/mail/cms-host.js +1 -1
- package/plugins/_lib/admin/mail/compose-window.js +1 -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 +1 -1
- package/plugins/_lib/admin/mail/folder-tree.js +26 -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 +4 -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 +9 -3
- package/plugins/_lib/admin/mail/reader-runtime.js +155 -6
- 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 +12 -4
- 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/domma-mail.lock.json +80 -80
- package/plugins/_lib/mail/accountFileStore.js +1 -1
- package/plugins/_lib/mail/accountRepository.js +23 -2
- package/plugins/_lib/mail/accountRoutes.js +1 -1
- package/plugins/_lib/mail/accounts.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 +8 -3
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.35.0] - 2026-11-03
|
|
4
|
+
|
|
5
|
+
- **Open or close every mail folder at once.** Email and Mail Reader offer Open all folders and Close all folders on a mailbox's right-click menu, on the Folders heading's right-click menu, and as a button in the Folders heading (which switches between the two, and is the place to find it with a single mailbox).
|
|
6
|
+
- **Mark a folder and the folders inside it.** In Email, Mark all as read and Mark all as unread on a folder that holds other folders open a submenu: This folder, or Including folders inside. Each folder is done in turn and one message reports the total.
|
|
7
|
+
|
|
8
|
+
## [1.34.0] - 2026-11-03
|
|
9
|
+
|
|
10
|
+
- Email Pro can notify for all folders or selected folders, with Check all and None controls in Email Settings. Folder choices are saved per mailbox and automatically included in background syncing. The sidebar badge continues to count Inbox unread messages. Folder notification marks are independent, including mailboxes with more than fifty folders.
|
|
11
|
+
|
|
3
12
|
## [1.33.0] - 2026-11-03
|
|
4
13
|
|
|
5
14
|
- **`[map]`** - a responsive Google Map of one place: `[map postcode="SW1A 2AA" zoom="15" caption="Visit us" /]`, or `address`, `pin="lat,lon"`, `lat` + `lon`. Zoom 1-20, `lng` as well as `lon`, ratio, width, alignment and a caption; malformed coordinates show a notice rather than a broken map. Google's embed host is always allowed to frame, so no `config/embeds.json` entry is needed. In the shortcode menus under Media.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const prefsKey=(t,e)=>`dm.notify.${t||"anon"}.${e}`,marksKey=(t,e)=>`dm.notify.seen.${t||"anon"}.${e}`;const y=
|
|
1
|
+
export const prefsKey=(t,e)=>`dm.notify.${t||"anon"}.${e}`,marksKey=(t,e)=>`dm.notify.seen.${t||"anon"}.${e}`;const y=1e4,b=200;export function cleanNotify(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e={};if(t.marks&&typeof t.marks=="object"&&!Array.isArray(t.marks))for(const[o,s]of Object.entries(t.marks).slice(0,1e4)){const r=Number(s);Number.isFinite(r)&&o.length<=200&&!["__proto__","constructor","prototype"].includes(o)&&(e[o]=r)}if(!Object.keys(e).length)return null;const n=o=>String(o??"").replace(/\s+/g," ").trim().slice(0,200);return{marks:e,title:n(t.title)||"Something new",body:n(t.body)}}export function compareMarks(t,e){const n=t&&typeof t=="object"?t:{},o={...n};let s=!1;for(const[r,c]of Object.entries(e)){const i=Number(n[r]);Number.isFinite(i)?c>i&&(s=!0,o[r]=c):o[r]=c}return{rose:s,next:o}}export function readNotifyPrefs(t,e,n=globalThis.S){try{const o=n?.get(prefsKey(t,e));return{popup:o?.popup===!0,sound:o?.sound===!0}}catch{return{popup:!1,sound:!1}}}export function writeNotifyPrefs(t,e,n,o=globalThis.S){o.set(prefsKey(t,e),{popup:n?.popup===!0,sound:n?.sound===!0})}export function playChime(){try{const t=globalThis.AudioContext||globalThis.webkitAudioContext;if(!t)return;const e=new t,n=e.currentTime;[[880,0],[1318.5,.12]].forEach(([o,s])=>{const r=e.createOscillator(),c=e.createGain();r.type="sine",r.frequency.value=o,c.gain.setValueAtTime(1e-4,n+s),c.gain.exponentialRampToValueAtTime(.18,n+s+.02),c.gain.exponentialRampToValueAtTime(1e-4,n+s+.35),r.connect(c).connect(e.destination),r.start(n+s),r.stop(n+s+.4)}),setTimeout(()=>{try{e.close()}catch{}},1e3)}catch{}}export function noticeFromCount(t,e,n,o={}){const s=o.store??globalThis.S,r=cleanNotify(n);if(!r||!s)return!1;let c=null;try{c=s.get(marksKey(t,e))}catch{c=null}const{rose:i,next:f}=compareMarks(c,r.marks);try{s.set(marksKey(t,e),f)}catch{}if(!i)return!1;const u=readNotifyPrefs(t,e,s);let a=!1;const l=o.Notification??globalThis.Notification;if(u.popup&&l&&l.permission==="granted")try{const p=new l(r.title,{body:r.body,tag:`dm-notify:${e}`});p.onclick=()=>{try{globalThis.focus?.()}catch{}(o.open??(m=>{globalThis.location.hash=m}))(e),p.close?.()},a=!0}catch{}return u.sound&&((o.chime??playChime)(),a=!0),a}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.0, packages/core/src/admin/mail/body-menu.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The reading pane's right-click menu - the pure parts.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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.22.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.22.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']);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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.
|
|
@@ -174,6 +174,31 @@ export function unreadInSubtree(node) {
|
|
|
174
174
|
return node.children.reduce((total, child) => total + unreadInSubtree(child), own);
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/**
|
|
178
|
+
* Every folder that has folders inside it - what "Close all folders" shuts.
|
|
179
|
+
*
|
|
180
|
+
* @param {object[]} roots
|
|
181
|
+
* @returns {string[]}
|
|
182
|
+
*/
|
|
183
|
+
export function foldablePaths(roots) {
|
|
184
|
+
return flattenFolderTree(roots).filter(node => node.children.length > 0).map(node => node.path);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* A folder and every folder beneath it that can hold mail, parent first -
|
|
189
|
+
* what "including folders inside" acts on. Unselectable levels (a parent a
|
|
190
|
+
* server lists only as a container, or one the tree synthesised) are left out.
|
|
191
|
+
*
|
|
192
|
+
* @param {object[]} roots
|
|
193
|
+
* @param {string} path
|
|
194
|
+
* @returns {string[]} empty when the path is not in the tree
|
|
195
|
+
*/
|
|
196
|
+
export function subtreePaths(roots, path) {
|
|
197
|
+
const node = flattenFolderTree(roots).find(item => item.path === path);
|
|
198
|
+
if (!node) return [];
|
|
199
|
+
return flattenFolderTree([node]).filter(item => item.selectable !== false).map(item => item.path);
|
|
200
|
+
}
|
|
201
|
+
|
|
177
202
|
/**
|
|
178
203
|
* Keep only the branches that lead to unread mail.
|
|
179
204
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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.22.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.22.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.22.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.22.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.22.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.22.0, packages/core/src/admin/mail/mail.html. -->
|
|
2
2
|
<div class="mail-layout">
|
|
3
3
|
|
|
4
4
|
<!-- Folders -->
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
<input type="checkbox" id="mail-unread-only">
|
|
10
10
|
<span>Unread</span>
|
|
11
11
|
</label>
|
|
12
|
+
<button class="btn btn-sm btn-ghost" id="mail-fold-all-btn" title="Close all folders" hidden>
|
|
13
|
+
<span data-icon="chevrons-right" data-icon-size="14"></span>
|
|
14
|
+
</button>
|
|
12
15
|
<button class="btn btn-sm btn-ghost" id="mail-new-folder-btn" title="New folder" hidden>
|
|
13
16
|
<span data-icon="folder-plus" data-icon-size="14"></span>
|
|
14
17
|
</button>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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.22.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.22.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.22.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
|
|
@@ -237,14 +237,20 @@ export function onceOnly() {
|
|
|
237
237
|
/**
|
|
238
238
|
* What a mailbox row's menu offers, as ids the view maps to actions.
|
|
239
239
|
*
|
|
240
|
-
* @param {{isCurrent: boolean, isDefault: boolean, count: number,
|
|
240
|
+
* @param {{isCurrent: boolean, isDefault: boolean, count: number, foldable?: number|null}} o
|
|
241
241
|
* @returns {{id: string, label: string, icon: string, disabled?: boolean, danger?: boolean}[]|object[]}
|
|
242
242
|
*/
|
|
243
|
-
export function accountMenuModel({isCurrent = false, isDefault = false, count = 1} = {}) {
|
|
243
|
+
export function accountMenuModel({isCurrent = false, isDefault = false, count = 1, foldable = null} = {}) {
|
|
244
|
+
// `foldable` is how many folders have folders inside, known only for the
|
|
245
|
+
// open mailbox; for another one the items open it first, so they stay on.
|
|
246
|
+
const nothingToFold = isCurrent && foldable === 0;
|
|
244
247
|
return [
|
|
245
248
|
{id: 'open', label: isCurrent ? 'Open (already open)' : 'Open', icon: 'inbox', disabled: isCurrent},
|
|
246
249
|
{id: 'refresh', label: 'Check for new mail', icon: 'refresh-cw', disabled: !isCurrent},
|
|
247
250
|
{type: 'divider'},
|
|
251
|
+
{id: 'expandAll', label: 'Open all folders', icon: 'chevrons-down', disabled: nothingToFold},
|
|
252
|
+
{id: 'collapseAll', label: 'Close all folders', icon: 'chevrons-right', disabled: nothingToFold},
|
|
253
|
+
{type: 'divider'},
|
|
248
254
|
{id: 'edit', label: 'Edit…', icon: 'edit-3'},
|
|
249
255
|
...(count > 1 ? [{id: 'default', label: isDefault ? 'Unset default' : 'Make default', icon: 'star'}] : []),
|
|
250
256
|
{type: 'divider'},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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);
|
|
@@ -35,9 +35,11 @@ const {
|
|
|
35
35
|
flattenFolderTree,
|
|
36
36
|
folderHeading,
|
|
37
37
|
folderMenuItems,
|
|
38
|
+
foldablePaths,
|
|
38
39
|
iconForFolder,
|
|
39
40
|
isSpamFolder,
|
|
40
41
|
pruneToUnread,
|
|
42
|
+
subtreePaths,
|
|
41
43
|
unreadInSubtree
|
|
42
44
|
} = await import(versioned('folder-tree.js'));
|
|
43
45
|
const {imageSendersSection} = await import(versioned('image-senders-section.js'));
|
|
@@ -296,6 +298,7 @@ return {
|
|
|
296
298
|
*/
|
|
297
299
|
let folderMenu = null;
|
|
298
300
|
let folderActionMenu = null;
|
|
301
|
+
let folderHeadMenu = null;
|
|
299
302
|
let folderActionBusy = false;
|
|
300
303
|
let dragState = null;
|
|
301
304
|
let dropBusy = false;
|
|
@@ -384,6 +387,27 @@ return {
|
|
|
384
387
|
renderFolders();
|
|
385
388
|
}
|
|
386
389
|
|
|
390
|
+
/**
|
|
391
|
+
* Open or shut every folder in a mailbox, opening that mailbox first
|
|
392
|
+
* when it is not the one on screen (only its folders are loaded).
|
|
393
|
+
*
|
|
394
|
+
* @param {string} accountId
|
|
395
|
+
* @param {boolean} open
|
|
396
|
+
* @returns {Promise<void>}
|
|
397
|
+
*/
|
|
398
|
+
async function setAllFolded(accountId, open) {
|
|
399
|
+
if (accountId !== currentAccountId) await selectAccount(accountId);
|
|
400
|
+
if (!here() || currentAccountId !== accountId) return;
|
|
401
|
+
const paths = open ? [] : foldablePaths(buildFolderTree(folders));
|
|
402
|
+
collapsedByAccount = {...collapsedByAccount, [currentAccountId]: paths};
|
|
403
|
+
try {
|
|
404
|
+
S.set(COLLAPSED_KEY, collapsedByAccount);
|
|
405
|
+
} catch {
|
|
406
|
+
// Storage unavailable - the fold still works for this visit.
|
|
407
|
+
}
|
|
408
|
+
renderFolders();
|
|
409
|
+
}
|
|
410
|
+
|
|
387
411
|
const foldersEl = $container.find('#mail-folders-list').get(0);
|
|
388
412
|
const listEl = $container.find('#mail-list').get(0);
|
|
389
413
|
const selectAllEl = $container.find('#mail-select-all').get(0);
|
|
@@ -393,6 +417,7 @@ return {
|
|
|
393
417
|
const readerBodyEl = $container.find('#mail-reader-body').get(0);
|
|
394
418
|
const listTitleEl = $container.find('#mail-list-title').get(0);
|
|
395
419
|
const folderActionsBtn = $container.find('#mail-folder-actions-btn').get(0);
|
|
420
|
+
const foldAllBtn = $container.find('#mail-fold-all-btn').get(0);
|
|
396
421
|
const searchEl = $container.find('#mail-search').get(0);
|
|
397
422
|
const searchInputEl = $container.find('#mail-search-input').get(0);
|
|
398
423
|
const searchClearEl = $container.find('#mail-search-clear').get(0);
|
|
@@ -691,6 +716,8 @@ return {
|
|
|
691
716
|
folderMenu = null;
|
|
692
717
|
folderActionMenu?.destroy?.();
|
|
693
718
|
folderActionMenu = null;
|
|
719
|
+
folderHeadMenu?.destroy?.();
|
|
720
|
+
folderHeadMenu = null;
|
|
694
721
|
clearDrag();
|
|
695
722
|
stopFitting?.();
|
|
696
723
|
stopFitting = null;
|
|
@@ -942,6 +969,7 @@ return {
|
|
|
942
969
|
canWrite: features.write,
|
|
943
970
|
canSend: features.send === true,
|
|
944
971
|
sidebarUrl: mailHost.routeHash,
|
|
972
|
+
renderNotificationSettings: extensions.notificationSettings,
|
|
945
973
|
host: mailHost,
|
|
946
974
|
userId: mailHost.getUser()?.id,
|
|
947
975
|
load: () => readDelaySeconds(S.get(READ_DELAY_KEY)),
|
|
@@ -1909,6 +1937,7 @@ return {
|
|
|
1909
1937
|
foldersEl.textContent = '';
|
|
1910
1938
|
if (folderActionsBtn) folderActionsBtn.disabled = !currentAccountId || folderActionBusy || !folders.length;
|
|
1911
1939
|
paintUnreadFilter();
|
|
1940
|
+
paintFoldAll();
|
|
1912
1941
|
|
|
1913
1942
|
for (const box of mailboxes) {
|
|
1914
1943
|
const isCurrent = box.id === currentAccountId;
|
|
@@ -2072,6 +2101,37 @@ return {
|
|
|
2072
2101
|
*
|
|
2073
2102
|
* @returns {void}
|
|
2074
2103
|
*/
|
|
2104
|
+
/**
|
|
2105
|
+
* What the Folders head offers for the open mailbox: open everything
|
|
2106
|
+
* when every branch is shut, otherwise close everything. Nothing to
|
|
2107
|
+
* fold, no button.
|
|
2108
|
+
*
|
|
2109
|
+
* @returns {{foldable: string[], allShut: boolean}}
|
|
2110
|
+
*/
|
|
2111
|
+
function foldAllState() {
|
|
2112
|
+
const foldable = currentAccountId ? foldablePaths(buildFolderTree(folders)) : [];
|
|
2113
|
+
const collapsed = collapsedSet();
|
|
2114
|
+
return {foldable, allShut: foldable.length > 0 && foldable.every(path => collapsed.has(path))};
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
/** @returns {void} */
|
|
2118
|
+
function paintFoldAll() {
|
|
2119
|
+
if (!foldAllBtn) return;
|
|
2120
|
+
const {foldable, allShut} = foldAllState();
|
|
2121
|
+
foldAllBtn.hidden = !foldable.length;
|
|
2122
|
+
const label = allShut ? 'Open all folders' : 'Close all folders';
|
|
2123
|
+
foldAllBtn.title = label;
|
|
2124
|
+
foldAllBtn.setAttribute('aria-label', label);
|
|
2125
|
+
const icon = allShut ? 'chevrons-down' : 'chevrons-right';
|
|
2126
|
+
if (foldAllBtn.dataset.icon === icon) return;
|
|
2127
|
+
foldAllBtn.dataset.icon = icon;
|
|
2128
|
+
const glyph = document.createElement('span');
|
|
2129
|
+
glyph.setAttribute('data-icon', icon);
|
|
2130
|
+
glyph.setAttribute('data-icon-size', '14');
|
|
2131
|
+
foldAllBtn.replaceChildren(glyph);
|
|
2132
|
+
try { Domma.icons?.scan?.(foldAllBtn); } catch { /* the title still names it */ }
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2075
2135
|
function paintUnreadFilter() {
|
|
2076
2136
|
const label = unreadFilterEl?.querySelector('span');
|
|
2077
2137
|
if (!label) return;
|
|
@@ -5213,6 +5273,24 @@ return {
|
|
|
5213
5273
|
return true;
|
|
5214
5274
|
}
|
|
5215
5275
|
});
|
|
5276
|
+
// The Folders head: open or close every folder - the only place
|
|
5277
|
+
// for it when there is one mailbox and so no mailbox row.
|
|
5278
|
+
const head = foldersEl.closest('.mail-folders-pane')?.querySelector('.mail-pane-head');
|
|
5279
|
+
if (head) {
|
|
5280
|
+
folderHeadMenu = elements.contextMenu(head, {
|
|
5281
|
+
inherit: false,
|
|
5282
|
+
items: [],
|
|
5283
|
+
onBeforeOpen: () => {
|
|
5284
|
+
const {foldable} = foldAllState();
|
|
5285
|
+
if (!foldable.length) return false;
|
|
5286
|
+
folderHeadMenu.setItems([
|
|
5287
|
+
{label: 'Open all folders', icon: 'chevrons-down', action: () => setAllFolded(currentAccountId, true)},
|
|
5288
|
+
{label: 'Close all folders', icon: 'chevrons-right', action: () => setAllFolded(currentAccountId, false)}
|
|
5289
|
+
]);
|
|
5290
|
+
return true;
|
|
5291
|
+
}
|
|
5292
|
+
});
|
|
5293
|
+
}
|
|
5216
5294
|
if (features.folders && folderActionsBtn) {
|
|
5217
5295
|
folderActionsBtn.hidden = false;
|
|
5218
5296
|
folderActionMenu = elements.contextMenu(folderActionsBtn, {
|
|
@@ -5239,10 +5317,13 @@ return {
|
|
|
5239
5317
|
return mergeExtensionItems(menuItems(accountMenuModel({
|
|
5240
5318
|
isCurrent: box.id === currentAccountId,
|
|
5241
5319
|
isDefault: box.isDefault === true,
|
|
5242
|
-
count: mailboxes.length
|
|
5320
|
+
count: mailboxes.length,
|
|
5321
|
+
foldable: box.id === currentAccountId ? foldablePaths(buildFolderTree(folders)).length : null
|
|
5243
5322
|
}), {
|
|
5244
5323
|
open: () => selectAccount(box.id),
|
|
5245
5324
|
refresh: () => refreshMailbox(),
|
|
5325
|
+
expandAll: () => setAllFolded(box.id, true),
|
|
5326
|
+
collapseAll: () => setAllFolded(box.id, false),
|
|
5246
5327
|
edit: () => openMailboxForm(box),
|
|
5247
5328
|
default: () => toggleDefaultMailbox(box),
|
|
5248
5329
|
remove: () => removeMailbox(box)
|
|
@@ -5289,14 +5370,23 @@ return {
|
|
|
5289
5370
|
const read = folderReadItems(folder);
|
|
5290
5371
|
const extra = extensionItems('folderItems', folder);
|
|
5291
5372
|
if (!features.folders) return mergeExtensionItems(read, extra);
|
|
5373
|
+
// A folder with folders inside offers "this one" or "the lot" as a
|
|
5374
|
+
// submenu; a leaf keeps the plain item.
|
|
5375
|
+
const inside = subtreePaths(buildFolderTree(folders), folder.path).filter(path => path !== folder.path);
|
|
5376
|
+
const markItem = (label, icon, action) => !inside.length
|
|
5377
|
+
? {label, icon, disabled: () => folderActionBusy, action: () => folderContentsAction(folder, action)}
|
|
5378
|
+
: {label, icon, disabled: () => folderActionBusy, submenu: [
|
|
5379
|
+
{label: 'This folder', icon: 'folder', disabled: () => folderActionBusy || folder.selectable === false,
|
|
5380
|
+
action: () => folderContentsAction(folder, action)},
|
|
5381
|
+
{label: 'Including folders inside', icon: 'folder-open', disabled: () => folderActionBusy,
|
|
5382
|
+
action: () => folderTreeAction(folder, action)}
|
|
5383
|
+
]};
|
|
5292
5384
|
return mergeExtensionItems([
|
|
5293
5385
|
...read,
|
|
5294
5386
|
{type: 'divider'},
|
|
5295
5387
|
{label: 'Refresh folders', icon: 'refresh-cw', action: () => refreshFolders()},
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
{label: 'Mark all as unread', icon: 'mail', disabled: () => folderActionBusy,
|
|
5299
|
-
action: () => folderContentsAction(folder, 'markUnread')},
|
|
5388
|
+
markItem('Mark all as read', 'mail-open', 'markRead'),
|
|
5389
|
+
markItem('Mark all as unread', 'mail', 'markUnread'),
|
|
5300
5390
|
{label: folder.specialUse === '\\Trash' ? 'Empty Trash...' : 'Clear folder...', icon: 'trash', danger: true,
|
|
5301
5391
|
disabled: () => folderActionBusy || ['\\All', '\\Flagged'].includes(folder.specialUse)
|
|
5302
5392
|
|| !folders.some(item => item.specialUse === '\\Trash'),
|
|
@@ -5352,6 +5442,62 @@ return {
|
|
|
5352
5442
|
], extra);
|
|
5353
5443
|
}
|
|
5354
5444
|
|
|
5445
|
+
/**
|
|
5446
|
+
* Mark every message in a folder and the folders beneath it, one
|
|
5447
|
+
* folder at a time (the server allows one folder action per mailbox).
|
|
5448
|
+
*
|
|
5449
|
+
* @param {object} folder
|
|
5450
|
+
* @param {'markRead'|'markUnread'} action
|
|
5451
|
+
* @returns {Promise<void>}
|
|
5452
|
+
*/
|
|
5453
|
+
async function folderTreeAction(folder, action) {
|
|
5454
|
+
if (folderActionBusy || !currentAccountId) return;
|
|
5455
|
+
const account = currentAccountId;
|
|
5456
|
+
const paths = subtreePaths(buildFolderTree(folders), folder.path);
|
|
5457
|
+
if (!paths.length) return;
|
|
5458
|
+
folderActionBusy = true;
|
|
5459
|
+
if (folderActionsBtn) folderActionsBtn.disabled = true;
|
|
5460
|
+
let count = 0;
|
|
5461
|
+
let done = 0;
|
|
5462
|
+
const failed = [];
|
|
5463
|
+
try {
|
|
5464
|
+
if (paths.includes(currentFolder)) cancelMarkRead();
|
|
5465
|
+
for (const path of paths) {
|
|
5466
|
+
if (!here() || currentAccountId !== account) return;
|
|
5467
|
+
try {
|
|
5468
|
+
const result = await api(`${BASE}/folders/messages?${new URLSearchParams({account})}`, 'POST', {
|
|
5469
|
+
path, action, confirmed: false
|
|
5470
|
+
});
|
|
5471
|
+
count += Number(result?.processed) || 0;
|
|
5472
|
+
done++;
|
|
5473
|
+
} catch {
|
|
5474
|
+
failed.push(path);
|
|
5475
|
+
}
|
|
5476
|
+
}
|
|
5477
|
+
if (!here() || currentAccountId !== account) return;
|
|
5478
|
+
const word = action === 'markRead' ? 'read' : 'unread';
|
|
5479
|
+
const where = `${done} folder${done === 1 ? '' : 's'}`;
|
|
5480
|
+
if (failed.length) {
|
|
5481
|
+
E.toast(`Marked ${count} messages as ${word} in ${where}; could not do ${failed.join(', ')}.`, {type: 'warning'});
|
|
5482
|
+
} else {
|
|
5483
|
+
E.toast(`Marked ${count} messages as ${word} in ${where}.`, {type: 'success'});
|
|
5484
|
+
}
|
|
5485
|
+
} finally {
|
|
5486
|
+
folderActionBusy = false;
|
|
5487
|
+
if (here()) {
|
|
5488
|
+
if (folderActionsBtn) folderActionsBtn.disabled = !currentAccountId || !folders.length;
|
|
5489
|
+
if (currentAccountId === account) {
|
|
5490
|
+
if (paths.includes(currentFolder)) {
|
|
5491
|
+
clearSelection();
|
|
5492
|
+
page = 1;
|
|
5493
|
+
}
|
|
5494
|
+
await refreshFolders();
|
|
5495
|
+
if (searchQuery) await loadMessages({fresh: true, quiet: true});
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
}
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5355
5501
|
/** Apply to the entire named folder, including messages beyond this page. */
|
|
5356
5502
|
async function folderContentsAction(folder, action) {
|
|
5357
5503
|
if (folderActionBusy || !currentAccountId) return;
|
|
@@ -6424,6 +6570,9 @@ return {
|
|
|
6424
6570
|
} catch { /* no banner: the pane buttons stay */ }
|
|
6425
6571
|
if (!here()) return;
|
|
6426
6572
|
$container.find('#mail-refresh-btn').on('click', () => refreshMailbox());
|
|
6573
|
+
foldAllBtn?.addEventListener('click', () => {
|
|
6574
|
+
if (currentAccountId) setAllFolded(currentAccountId, foldAllState().allShut);
|
|
6575
|
+
});
|
|
6427
6576
|
|
|
6428
6577
|
// Folder management was right-click only, which is the same as not
|
|
6429
6578
|
// existing for anyone who does not already know it is there.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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.22.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.22.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.22.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.22.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.22.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.22.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';
|
|
@@ -128,7 +128,7 @@ export function permissionWords(permission) {
|
|
|
128
128
|
* notifications hang off (admin/js/lib/sidebar-notify.js).
|
|
129
129
|
* @returns {object}
|
|
130
130
|
*/
|
|
131
|
-
export function createSettingsSection({canWrite, canSend = false, load, save, sidebarUrl = null, userId = null, host = null}) {
|
|
131
|
+
export function createSettingsSection({canWrite, canSend = false, load, save, sidebarUrl = null, userId = null, host = null, renderNotificationSettings = null}) {
|
|
132
132
|
const S = host?.storage ?? globalThis.S;
|
|
133
133
|
return {
|
|
134
134
|
id: 'settings',
|
|
@@ -138,7 +138,7 @@ export function createSettingsSection({canWrite, canSend = false, load, save, si
|
|
|
138
138
|
const kit = await import(new URL(`./section-kit.js?v=${ctx.assetVersion ?? '1'}`, import.meta.url).href);
|
|
139
139
|
const notify = sidebarUrl ? (host?.helpers.notifications ?? null) : null;
|
|
140
140
|
const who = userId ?? host?.getUser()?.id ?? null;
|
|
141
|
-
kit.note(container, '
|
|
141
|
+
kit.note(container, 'Reading, composing, popup and sound preferences are saved in this browser and apply to all your mailboxes.');
|
|
142
142
|
|
|
143
143
|
const saveSteps = [];
|
|
144
144
|
|
|
@@ -204,13 +204,21 @@ export function createSettingsSection({canWrite, canSend = false, load, save, si
|
|
|
204
204
|
// ---- Notifications -------------------------------------------
|
|
205
205
|
if (notify) {
|
|
206
206
|
kit.heading(container, 'Notifications');
|
|
207
|
-
kit.note(container, 'While the admin is open in any tab, new mail
|
|
207
|
+
kit.note(container, 'While the admin is open in any tab, new mail can pop up a notification and play a sound - checked about once a minute.');
|
|
208
208
|
const current = notify.readNotifyPrefs(who, sidebarUrl);
|
|
209
209
|
const supported = typeof Notification === 'function';
|
|
210
210
|
const {state} = kit.formIn(container, {
|
|
211
211
|
popup: {type: 'boolean', label: 'Show new messages notification popups', formConfig: {disabled: !supported}},
|
|
212
212
|
sound: {type: 'boolean', label: 'Sound notification'}
|
|
213
213
|
}, {popup: current.popup && supported, sound: current.sound});
|
|
214
|
+
if (renderNotificationSettings && ctx.account) {
|
|
215
|
+
try {
|
|
216
|
+
const saveFolders = await renderNotificationSettings(container, ctx, kit);
|
|
217
|
+
if (saveFolders) saveSteps.push(() => saveFolders);
|
|
218
|
+
} catch (err) {
|
|
219
|
+
kit.note(container, `Notification folders could not be loaded: ${err.message || 'Try reopening Settings.'}`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
214
222
|
const status = kit.note(container, permissionWords(supported ? Notification.permission : undefined));
|
|
215
223
|
const tools = kit.box(container, 'flex gap-2 items-center mb-2');
|
|
216
224
|
kit.button(tools, 'Play the sound', () => notify.playChime(), {icon: 'play'});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.22.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.22.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.22.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.22.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.
|