@bobfrankston/rmfmail 1.2.67 → 1.2.69

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.
@@ -210,8 +210,8 @@ function cancelServerSearch() {
210
210
  function getMessage(accountId, uid, allowRemote = false, folderId) {
211
211
  return ipc().getMessage(accountId, uid, allowRemote, folderId);
212
212
  }
213
- function updateFlags(accountId, uid, flags) {
214
- return ipc().updateFlags(accountId, uid, flags);
213
+ function updateFlags(accountId, uid, flags, folderId) {
214
+ return ipc().updateFlags(accountId, uid, flags, folderId);
215
215
  }
216
216
  function triggerSync() {
217
217
  return ipc().syncAll();
@@ -1400,7 +1400,7 @@ async function showMessage(accountId, uid, folderId, specialUse, isRetry = false
1400
1400
  if (captureGen !== showMessageGeneration)
1401
1401
  return;
1402
1402
  setSeen(msg, true);
1403
- updateFlags(accountId, uid, msg.flags);
1403
+ updateFlags(accountId, uid, msg.flags, msg.folderId);
1404
1404
  try {
1405
1405
  updateMessageFlags(accountId, uid, msg.flags);
1406
1406
  } catch {
@@ -2762,6 +2762,7 @@ __export(message_list_exports, {
2762
2762
  removeMessagesAndReconcile: () => removeMessagesAndReconcile,
2763
2763
  revealMessage: () => revealMessage,
2764
2764
  scrollFocusedIntoView: () => scrollFocusedIntoView,
2765
+ selectAllVisible: () => selectAllVisible,
2765
2766
  setLiveFilter: () => setLiveFilter,
2766
2767
  setRowFlagged: () => setRowFlagged,
2767
2768
  setRowSeen: () => setRowSeen,
@@ -2997,9 +2998,9 @@ async function bulkSetFlagged(rows, flagged) {
2997
2998
  const prevFlags = [...row.msg.flags || []];
2998
2999
  row.isFlagged = flagged;
2999
3000
  try {
3000
- await updateFlags(row.accountId, row.msg.uid, row.msg.flags);
3001
+ await updateFlags(row.accountId, row.msg.uid, row.msg.flags, row.msg.folderId);
3001
3002
  updateMessageFlags(row.accountId, row.msg.uid, row.msg.flags);
3002
- undo.push({ accountId: row.accountId, uid: row.msg.uid, prevFlagged: prev });
3003
+ undo.push({ accountId: row.accountId, uid: row.msg.uid, prevFlagged: prev, folderId: row.msg.folderId });
3003
3004
  } catch {
3004
3005
  row.msg.flags = prevFlags;
3005
3006
  row.setFlaggedClass(prev);
@@ -3016,7 +3017,7 @@ async function bulkSetSeen(rows, seen) {
3016
3017
  const prevFlags = [...row.msg.flags || []];
3017
3018
  row.isSeen = seen;
3018
3019
  try {
3019
- await updateFlags(row.accountId, row.msg.uid, row.msg.flags);
3020
+ await updateFlags(row.accountId, row.msg.uid, row.msg.flags, row.msg.folderId);
3020
3021
  updateMessageFlags(row.accountId, row.msg.uid, row.msg.flags);
3021
3022
  } catch {
3022
3023
  row.msg.flags = prevFlags;
@@ -3224,6 +3225,14 @@ function exitMultiSelect() {
3224
3225
  }
3225
3226
  function updateBulkBar() {
3226
3227
  }
3228
+ function selectAllVisible() {
3229
+ const body = document.getElementById("ml-body");
3230
+ if (!body)
3231
+ return;
3232
+ body.classList.add("multi-select-on");
3233
+ body.querySelectorAll(".ml-row:not(.filter-hidden)").forEach((r) => r.classList.add("selected"));
3234
+ updateBulkBar();
3235
+ }
3227
3236
  function selectRange(from, to) {
3228
3237
  const body = document.getElementById("ml-body");
3229
3238
  if (!body)
@@ -4208,7 +4217,7 @@ var init_message_list = __esm({
4208
4217
  const newFlaggedState = !this.el.classList.contains("flagged");
4209
4218
  const prevFlags = [...this.msg.flags || []];
4210
4219
  this.isFlagged = newFlaggedState;
4211
- updateFlags(this.accountId, this.msg.uid, this.msg.flags).catch(() => {
4220
+ updateFlags(this.accountId, this.msg.uid, this.msg.flags, this.msg.folderId).catch(() => {
4212
4221
  this.msg.flags = prevFlags;
4213
4222
  this.setFlaggedClass(!newFlaggedState);
4214
4223
  });
@@ -6231,7 +6240,12 @@ function initTabs(strip, apply) {
6231
6240
  if (raw) {
6232
6241
  const parsed = JSON.parse(raw);
6233
6242
  if (Array.isArray(parsed?.tabs) && parsed.tabs.length) {
6234
- tabs = parsed.tabs;
6243
+ tabs = parsed.tabs.map((t) => {
6244
+ if (t.view?.kind !== "search")
6245
+ return t;
6246
+ const v = t.view;
6247
+ return v.folderId ? { id: t.id, title: "Mail", view: { kind: "folder", accountId: v.accountId, folderId: v.folderId, specialUse: "" } } : { id: t.id, title: "All Inboxes", view: { kind: "unified" } };
6248
+ });
6235
6249
  activeId = parsed.activeId || tabs[0].id;
6236
6250
  for (const t of tabs) {
6237
6251
  const n = Number(String(t.id).replace(/^t/, ""));
@@ -8490,7 +8504,7 @@ async function performUndo() {
8490
8504
  for (const entry of op.payload) {
8491
8505
  const flag = "\\Flagged";
8492
8506
  const flagsAfter = entry.prevFlagged ? [flag] : [];
8493
- await updateFlags2(entry.accountId, entry.uid, flagsAfter);
8507
+ await updateFlags2(entry.accountId, entry.uid, flagsAfter, entry.folderId);
8494
8508
  setRowFlagged(entry.accountId, entry.uid, entry.prevFlagged);
8495
8509
  updateMessageFlags(entry.accountId, entry.uid, flagsAfter);
8496
8510
  }
@@ -8663,7 +8677,8 @@ async function bulkFlagSelected() {
8663
8677
  const undoPayload = rows.map((r) => ({
8664
8678
  accountId: r.accountId,
8665
8679
  uid: r.uid,
8666
- prevFlagged: flaggedOf(r)
8680
+ prevFlagged: flaggedOf(r),
8681
+ folderId: r.folderId
8667
8682
  }));
8668
8683
  const { updateFlags: updateFlags2 } = await Promise.resolve().then(() => (init_api_client(), api_client_exports));
8669
8684
  for (const r of rows) {
@@ -8672,7 +8687,7 @@ async function bulkFlagSelected() {
8672
8687
  setRowFlagged(r.accountId, r.uid, targetFlagged);
8673
8688
  updateMessageFlags(r.accountId, r.uid, r.flags);
8674
8689
  try {
8675
- await updateFlags2(r.accountId, r.uid, r.flags);
8690
+ await updateFlags2(r.accountId, r.uid, r.flags, r.folderId);
8676
8691
  } catch (e) {
8677
8692
  console.error(`Bulk flag failed for ${r.accountId}/${r.uid}: ${e?.message || e}`);
8678
8693
  }
@@ -8692,7 +8707,7 @@ document.getElementById("btn-flag")?.addEventListener("click", async () => {
8692
8707
  setFlagged(sel, !wasFlagged);
8693
8708
  updateFlagButton();
8694
8709
  try {
8695
- await updateFlags(sel.accountId, sel.uid, sel.flags);
8710
+ await updateFlags(sel.accountId, sel.uid, sel.flags, sel.folderId);
8696
8711
  updateMessageFlags(sel.accountId, sel.uid, sel.flags);
8697
8712
  setRowFlagged(sel.accountId, sel.uid, !wasFlagged);
8698
8713
  } catch (e) {
@@ -8793,7 +8808,7 @@ document.getElementById("btn-mark-unread")?.addEventListener("click", () => {
8793
8808
  if (!sel) return;
8794
8809
  const wasSeen = seenOf(sel);
8795
8810
  setSeen(sel, !wasSeen);
8796
- updateFlags(sel.accountId, sel.uid, sel.flags).then(() => {
8811
+ updateFlags(sel.accountId, sel.uid, sel.flags, sel.folderId).then(() => {
8797
8812
  updateMessageFlags(sel.accountId, sel.uid, sel.flags);
8798
8813
  const row = document.querySelector(`.ml-row[data-uid="${sel.uid}"][data-account-id="${sel.accountId}"]`);
8799
8814
  if (row) row.classList.toggle("unread", wasSeen);
@@ -9922,7 +9937,7 @@ document.addEventListener("keydown", (e) => {
9922
9937
  const mlBody = document.getElementById("ml-body");
9923
9938
  if (mlBody) {
9924
9939
  e.preventDefault();
9925
- mlBody.querySelectorAll(".ml-row").forEach((r) => r.classList.add("selected"));
9940
+ selectAllVisible();
9926
9941
  }
9927
9942
  }
9928
9943
  if (e.ctrlKey && e.key === "d" || e.key === "Delete") {
@@ -9956,7 +9971,7 @@ document.addEventListener("keydown", (e) => {
9956
9971
  e.preventDefault();
9957
9972
  const applySeen = (m, seen) => {
9958
9973
  setSeen(m, seen);
9959
- updateFlags(m.accountId, m.uid, m.flags).then(() => {
9974
+ updateFlags(m.accountId, m.uid, m.flags, m.folderId).then(() => {
9960
9975
  updateMessageFlags(m.accountId, m.uid, m.flags);
9961
9976
  const row = document.querySelector(`.ml-row[data-uid="${m.uid}"][data-account-id="${CSS.escape(m.accountId)}"]`);
9962
9977
  if (row) row.classList.toggle("unread", !seen);
@@ -11684,12 +11699,13 @@ function saveBootSnapshot() {
11684
11699
  const messageList2 = document.getElementById("ml-body");
11685
11700
  const folderTitle = document.getElementById("ml-folder-title");
11686
11701
  const ftHtml = folderTree2?.innerHTML?.trim() || "";
11687
- const mlHtml = messageList2?.innerHTML?.trim() || "";
11702
+ const searching = (searchInput?.value.trim() || "") !== "";
11703
+ const mlHtml = searching ? "" : messageList2?.innerHTML?.trim() || "";
11688
11704
  if (!ftHtml && !mlHtml) return;
11689
11705
  const snap = {
11690
11706
  folderTree: ftHtml,
11691
11707
  messageList: mlHtml,
11692
- folderTitle: folderTitle?.innerHTML?.trim() || "",
11708
+ folderTitle: searching ? "" : folderTitle?.innerHTML?.trim() || "",
11693
11709
  savedAt: Date.now()
11694
11710
  };
11695
11711
  localStorage.setItem("mailx-boot-snapshot", JSON.stringify(snap));