@bobfrankston/rmfmail 1.2.261 → 1.2.263

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.
@@ -2568,16 +2568,7 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
2568
2568
  const fromEl = headerEl.querySelector(".mv-from");
2569
2569
  const toEl = headerEl.querySelector(".mv-to");
2570
2570
  fromEl.textContent = formatAddr(msg.from);
2571
- let toLine = `To: ${msg.to.map(formatAddr).join(", ")}`;
2572
- if (msg.cc?.length)
2573
- toLine += ` Cc: ${msg.cc.map(formatAddr).join(", ")}`;
2574
- const toAddrs = (msg.to || []).map((a) => a.address.toLowerCase());
2575
- const ccAddrs = (msg.cc || []).map((a) => a.address.toLowerCase());
2576
- const dt = (msg.deliveredTo || "").toLowerCase();
2577
- if (msg.deliveredTo && !toAddrs.includes(dt) && !ccAddrs.includes(dt)) {
2578
- toLine += ` Delivered-To: ${msg.deliveredTo}`;
2579
- }
2580
- toEl.textContent = toLine;
2571
+ setRecipientLine(toEl, msg.to, msg.cc, msg.deliveredTo);
2581
2572
  headerEl.querySelector(".mv-subject").textContent = msg.subject;
2582
2573
  document.dispatchEvent(new CustomEvent("mailx-message-shown", { detail: { accountId } }));
2583
2574
  for (const el of [fromEl, toEl]) {
@@ -2585,7 +2576,9 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
2585
2576
  e.preventDefault();
2586
2577
  const me = e;
2587
2578
  const items = [];
2588
- const addrs = el === fromEl ? [msg.from] : [...msg.to || [], ...msg.cc || []];
2579
+ const allAddrs = el === fromEl ? [msg.from] : [...msg.to || [], ...msg.cc || []];
2580
+ const addrs = allAddrs.slice(0, CONTEXT_MENU_ADDR_CAP);
2581
+ const omitted = allAddrs.length - addrs.length;
2589
2582
  for (const addr of addrs) {
2590
2583
  if (!addr?.address)
2591
2584
  continue;
@@ -2660,6 +2653,14 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
2660
2653
  items.push({ label: "", action: () => {
2661
2654
  }, separator: true });
2662
2655
  }
2656
+ if (omitted > 0) {
2657
+ items.push({
2658
+ label: `\u2026 ${omitted} more recipients \u2014 copy the whole list`,
2659
+ action: () => navigator.clipboard.writeText(allAddrs.map(formatAddr).join(", "))
2660
+ });
2661
+ items.push({ label: "", action: () => {
2662
+ }, separator: true });
2663
+ }
2663
2664
  items.push({ label: "Reply", action: () => document.dispatchEvent(new CustomEvent("mailx-compose", { detail: { mode: "reply" } })) });
2664
2665
  items.push({ label: "Reply All", action: () => document.dispatchEvent(new CustomEvent("mailx-compose", { detail: { mode: "replyAll" } })) });
2665
2666
  items.push({ label: "Forward", action: () => document.dispatchEvent(new CustomEvent("mailx-compose", { detail: { mode: "forward" } })) });
@@ -3244,6 +3245,40 @@ function formatAddr(addr) {
3244
3245
  return `${addr.name} <${addr.address}>`;
3245
3246
  return addr.address;
3246
3247
  }
3248
+ function setRecipientLine(toEl, to, cc, deliveredTo) {
3249
+ const toList = to || [];
3250
+ const ccList = cc || [];
3251
+ let line = `To: ${toList.map(formatAddr).join(", ")}`;
3252
+ if (ccList.length)
3253
+ line += ` Cc: ${ccList.map(formatAddr).join(", ")}`;
3254
+ if (deliveredTo) {
3255
+ const dt = deliveredTo.toLowerCase();
3256
+ const covered = [...toList, ...ccList].some((a) => a.address.toLowerCase() === dt);
3257
+ if (!covered)
3258
+ line += ` Delivered-To: ${deliveredTo}`;
3259
+ }
3260
+ toEl.textContent = "";
3261
+ toEl.classList.remove("mv-to-expanded");
3262
+ const text = document.createElement("span");
3263
+ text.className = "mv-to-text";
3264
+ text.textContent = line;
3265
+ toEl.append(text);
3266
+ const count = toList.length + ccList.length;
3267
+ const clamped = text.scrollHeight > text.clientHeight + 1;
3268
+ if (count <= MANY_RECIPIENTS && !clamped)
3269
+ return;
3270
+ const toggle = document.createElement("button");
3271
+ toggle.className = "mv-to-toggle";
3272
+ toggle.type = "button";
3273
+ const label = count === 1 ? "1 recipient" : `${count} recipients`;
3274
+ const paint = (open) => {
3275
+ toggle.textContent = `${open ? "\u25BE" : "\u25B8"} ${label}`;
3276
+ toggle.title = open ? "Collapse the recipient list" : "Show the full recipient list";
3277
+ };
3278
+ paint(false);
3279
+ toggle.addEventListener("click", () => paint(toEl.classList.toggle("mv-to-expanded")));
3280
+ toEl.append(toggle);
3281
+ }
3247
3282
  function renderHeaderFromEnvelope(headerEl, env) {
3248
3283
  headerEl.hidden = false;
3249
3284
  const fromEl = headerEl.querySelector(".mv-from");
@@ -3252,12 +3287,8 @@ function renderHeaderFromEnvelope(headerEl, env) {
3252
3287
  const dateEl = headerEl.querySelector(".mv-date");
3253
3288
  if (fromEl)
3254
3289
  fromEl.textContent = formatAddr(env.from);
3255
- if (toEl) {
3256
- let toLine = `To: ${(env.to || []).map(formatAddr).join(", ")}`;
3257
- if (env.cc?.length)
3258
- toLine += ` Cc: ${env.cc.map(formatAddr).join(", ")}`;
3259
- toEl.textContent = toLine;
3260
- }
3290
+ if (toEl)
3291
+ setRecipientLine(toEl, env.to, env.cc);
3261
3292
  if (subjEl)
3262
3293
  subjEl.textContent = env.subject || "";
3263
3294
  if (dateEl) {
@@ -4027,7 +4058,7 @@ function spawnDesktopPopout(msg, accountId) {
4027
4058
  function escapeHtmlLocal(s) {
4028
4059
  return (s || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4029
4060
  }
4030
- var pendingImageCopies, imageCopySeq, IMAGE_COPY_TIMEOUT_MS, currentMessage, currentAccountId, dragOutUrls, showMessageGeneration, retryCount, lastEnvelope, PARSED_CACHE_LIMIT, parsedCache, sessionAllowedRemote, recentFetchErrors, WAIT_GIVE_UP_SECS, ZOOM_KEY, ZOOM_MIN, ZOOM_MAX, ZOOM_STEP, previewZoom, HIGHLIGHT_NAME, HIGHLIGHT_MAX, searchHighlightTerms, RENDER_MARK_KEY, RENDER_MARK_MAX_AGE_MS, poisonedMessages, renderKey, PROGRESSIVE_TEXT_THRESHOLD, TEXT_CHUNK_BYTES;
4061
+ var pendingImageCopies, imageCopySeq, IMAGE_COPY_TIMEOUT_MS, currentMessage, currentAccountId, dragOutUrls, showMessageGeneration, retryCount, lastEnvelope, PARSED_CACHE_LIMIT, parsedCache, sessionAllowedRemote, recentFetchErrors, WAIT_GIVE_UP_SECS, ZOOM_KEY, ZOOM_MIN, ZOOM_MAX, ZOOM_STEP, previewZoom, HIGHLIGHT_NAME, HIGHLIGHT_MAX, searchHighlightTerms, RENDER_MARK_KEY, RENDER_MARK_MAX_AGE_MS, poisonedMessages, renderKey, MANY_RECIPIENTS, CONTEXT_MENU_ADDR_CAP, PROGRESSIVE_TEXT_THRESHOLD, TEXT_CHUNK_BYTES;
4031
4062
  var init_message_viewer = __esm({
4032
4063
  "client/components/message-viewer.js"() {
4033
4064
  "use strict";
@@ -4111,6 +4142,8 @@ var init_message_viewer = __esm({
4111
4142
  } catch {
4112
4143
  }
4113
4144
  })();
4145
+ MANY_RECIPIENTS = 6;
4146
+ CONTEXT_MENU_ADDR_CAP = 12;
4114
4147
  PROGRESSIVE_TEXT_THRESHOLD = 200 * 1024;
4115
4148
  TEXT_CHUNK_BYTES = 64 * 1024;
4116
4149
  subscribeStore("*", (ev) => {