@bobfrankston/rmfmail 1.0.696 → 1.0.698

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.
@@ -998,10 +998,11 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
998
998
  } catch {
999
999
  }
1000
1000
  if (!cachedMsg) {
1001
- bodyEl.innerHTML = `<div class="mv-preview-placeholder">${escapeHtml(cached.preview || "")}</div>`;
1001
+ const previewText = (cached.preview || "").trim();
1002
+ bodyEl.innerHTML = previewText ? `<div class="mv-preview-placeholder">${escapeHtml(previewText)}</div>` : `<div class="mv-empty">Loading body\u2026</div>`;
1002
1003
  }
1003
1004
  } else if (!cachedMsg) {
1004
- bodyEl.innerHTML = "";
1005
+ bodyEl.innerHTML = `<div class="mv-empty">Loading body\u2026</div>`;
1005
1006
  headerEl.hidden = true;
1006
1007
  }
1007
1008
  attEl.hidden = true;
@@ -1024,7 +1025,8 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1024
1025
  headerEl.hidden = false;
1025
1026
  } catch {
1026
1027
  }
1027
- bodyEl.innerHTML = `<div class="mv-preview-placeholder">${escapeHtml(msg.preview || cached?.preview || "")}</div>`;
1028
+ const previewText = (msg.preview || cached?.preview || "").trim();
1029
+ bodyEl.innerHTML = previewText ? `<div class="mv-preview-placeholder">${escapeHtml(previewText)}</div>` : `<div class="mv-empty">Fetching body from server\u2026</div>`;
1028
1030
  const captureGen = gen;
1029
1031
  const off = onEvent((ev) => {
1030
1032
  if (!ev || ev.type !== "bodyAvailable")
@@ -1196,15 +1198,28 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1196
1198
  const m = mailUrl.match(/^mailto:([^?]*)(?:\?(.*))?$/i);
1197
1199
  const to = m?.[1] ? decodeURIComponent(m[1]) : "";
1198
1200
  const qs = new URLSearchParams(m?.[2] || "");
1199
- const subject = qs.get("subject") || "Unsubscribe";
1200
- const body = qs.get("body") || "";
1201
+ const origFrom = msg.from ? msg.from.name ? `${msg.from.name} <${msg.from.address}>` : msg.from.address : "";
1202
+ const origSubject = msg.subject || "";
1203
+ const origDate = msg.date ? new Date(msg.date).toLocaleString(void 0, { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", hour12: false }) : "";
1204
+ const subject = qs.get("subject") || (origSubject ? `Unsubscribe: ${origSubject}` : "Unsubscribe");
1205
+ const inlineBody = qs.get("body") || "";
1206
+ const escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1207
+ const contextLines = [];
1208
+ if (origFrom)
1209
+ contextLines.push(`From: ${escape(origFrom)}`);
1210
+ if (origSubject)
1211
+ contextLines.push(`Subject: ${escape(origSubject)}`);
1212
+ if (origDate)
1213
+ contextLines.push(`Date: ${escape(origDate)}`);
1214
+ const contextBlock = contextLines.length ? `<p>\u2014<br>${contextLines.join("<br>")}</p>` : "";
1215
+ const bodyHtml = inlineBody ? `<p>${escape(inlineBody)}</p>${contextBlock}` : `<p>Please unsubscribe me from this list.</p>${contextBlock}`;
1201
1216
  const init = {
1202
1217
  mode: "new",
1203
1218
  accountId: currentAccountId,
1204
1219
  to: to ? [{ name: "", address: to }] : [],
1205
1220
  cc: [],
1206
1221
  subject,
1207
- bodyHtml: body ? `<p>${body}</p>` : "",
1222
+ bodyHtml,
1208
1223
  inReplyTo: "",
1209
1224
  references: [],
1210
1225
  accounts: []
@@ -3157,8 +3172,13 @@ var init_message_list = __esm({
3157
3172
  }
3158
3173
  const body = this.el.parentElement;
3159
3174
  if (body?.classList.contains("multi-select-on")) {
3160
- this.setSelected(!this.isSelected);
3175
+ const willBeSelected = !this.isSelected;
3176
+ this.setSelected(willBeSelected);
3161
3177
  lastClickedRow = this.el;
3178
+ if (willBeSelected) {
3179
+ focusRow(this);
3180
+ this.setUnreadClass(false);
3181
+ }
3162
3182
  updateBulkBar();
3163
3183
  return;
3164
3184
  }
@@ -4423,7 +4443,9 @@ async function collectDueAlarms(now) {
4423
4443
  const startMs = ev.startMs || 0;
4424
4444
  if (!startMs)
4425
4445
  continue;
4426
- const offsets = Array.isArray(ev.reminderMinutes) && ev.reminderMinutes.length > 0 ? ev.reminderMinutes.map((m) => m * 6e4) : [CAL_LEAD_MS];
4446
+ if (!Array.isArray(ev.reminderMinutes) || ev.reminderMinutes.length === 0)
4447
+ continue;
4448
+ const offsets = ev.reminderMinutes.map((m) => m * 6e4);
4427
4449
  for (const offsetMs of offsets) {
4428
4450
  const occBaseKey = occKey(ev.uuid, startMs);
4429
4451
  const key = `${occBaseKey}@${offsetMs}`;
@@ -4738,14 +4760,13 @@ function startAlarmPoller() {
4738
4760
  });
4739
4761
  });
4740
4762
  }
4741
- var DISMISSED_KEY, SNOOZED_KEY, CAL_LEAD_MS, LOOKBACK_MS, LOOKAHEAD_MS, POLL_INTERVAL_MS, firedThisSession, openPopups;
4763
+ var DISMISSED_KEY, SNOOZED_KEY, LOOKBACK_MS, LOOKAHEAD_MS, POLL_INTERVAL_MS, firedThisSession, openPopups;
4742
4764
  var init_alarms = __esm({
4743
4765
  "client/components/alarms.js"() {
4744
4766
  "use strict";
4745
4767
  init_api_client();
4746
4768
  DISMISSED_KEY = "mailx-alarm-dismissed";
4747
4769
  SNOOZED_KEY = "mailx-alarm-snoozed";
4748
- CAL_LEAD_MS = 10 * 60 * 1e3;
4749
4770
  LOOKBACK_MS = 60 * 60 * 1e3;
4750
4771
  LOOKAHEAD_MS = 2 * 60 * 60 * 1e3;
4751
4772
  POLL_INTERVAL_MS = 3e4;