@bobfrankston/rmfmail 1.2.224 → 1.2.225

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/client/app.js CHANGED
@@ -1894,8 +1894,8 @@ async function performUndo() {
1894
1894
  ? [flag] // simplest restore — full set is unknown here
1895
1895
  : [];
1896
1896
  await updateFlags(entry.accountId, entry.uid, flagsAfter, entry.folderId);
1897
- setRowFlagged(entry.accountId, entry.uid, entry.prevFlagged);
1898
- messageState.updateMessageFlags(entry.accountId, entry.uid, flagsAfter);
1897
+ setRowFlagged(entry.accountId, entry.uid, entry.prevFlagged, entry.folderId);
1898
+ messageState.updateMessageFlags(entry.accountId, entry.uid, flagsAfter, entry.folderId);
1899
1899
  }
1900
1900
  if (statusSync)
1901
1901
  statusSync.textContent = `Undid flag change on ${op.payload.length} message${op.payload.length !== 1 ? "s" : ""}${remaining}`;
@@ -2131,8 +2131,8 @@ async function bulkFlagSelected() {
2131
2131
  if (flaggedOf(r) === targetFlagged)
2132
2132
  continue;
2133
2133
  setFlagged(r, targetFlagged);
2134
- setRowFlagged(r.accountId, r.uid, targetFlagged);
2135
- messageState.updateMessageFlags(r.accountId, r.uid, r.flags);
2134
+ setRowFlagged(r.accountId, r.uid, targetFlagged, r.folderId);
2135
+ messageState.updateMessageFlags(r.accountId, r.uid, r.flags, r.folderId);
2136
2136
  try {
2137
2137
  await updateFlags(r.accountId, r.uid, r.flags, r.folderId);
2138
2138
  }
@@ -2157,10 +2157,10 @@ document.getElementById("btn-flag")?.addEventListener("click", async () => {
2157
2157
  updateFlagButton();
2158
2158
  try {
2159
2159
  await updateFlags(sel.accountId, sel.uid, sel.flags, sel.folderId);
2160
- messageState.updateMessageFlags(sel.accountId, sel.uid, sel.flags);
2160
+ messageState.updateMessageFlags(sel.accountId, sel.uid, sel.flags, sel.folderId);
2161
2161
  // Row owns its own DOM \u2014 go through the row object so class + star
2162
2162
  // update atomically and the list/preview stay in sync.
2163
- setRowFlagged(sel.accountId, sel.uid, !wasFlagged);
2163
+ setRowFlagged(sel.accountId, sel.uid, !wasFlagged, sel.folderId);
2164
2164
  }
2165
2165
  catch (e) {
2166
2166
  // Revert local state on failure so visual + data stay consistent.
@@ -2234,10 +2234,24 @@ async function spamSelectedMessages() {
2234
2234
  if (result?.targetFolderId)
2235
2235
  spamUndo.targetFolderId = result.targetFolderId;
2236
2236
  })
2237
- .catch(e => {
2237
+ .catch(async (e) => {
2238
2238
  console.error(`[spam] ${accountId} failed:`, e);
2239
+ // The optimistic remove above already took these rows off the
2240
+ // list. If the move genuinely failed, leaving them gone is a
2241
+ // LIE — the message is still in the inbox and reappears at the
2242
+ // next sync looking like it "came back" (Bob 2026-08-07, where
2243
+ // the Android markAsSpamMessages stub threw on every click and
2244
+ // only a status-bar line said so). Put the list back and say it
2245
+ // loudly enough to be seen on a phone.
2239
2246
  if (statusSync)
2240
- statusSync.textContent = `Spam sync issue (${accountId}): ${e?.message || e}`;
2247
+ statusSync.textContent = `Spam FAILED (${accountId}): ${e?.message || e}`;
2248
+ try {
2249
+ await reloadCurrentFolder();
2250
+ }
2251
+ catch { /* list rebuilds on next sync */ }
2252
+ window.dispatchEvent(new CustomEvent("mailx-alert", {
2253
+ detail: { message: `Couldn't move ${uids.length} message(s) to spam: ${e?.message || e}`, key: "spam-move" },
2254
+ }));
2241
2255
  });
2242
2256
  }
2243
2257
  }
@@ -2305,7 +2319,7 @@ document.getElementById("btn-mark-unread")?.addEventListener("click", () => {
2305
2319
  const wasSeen = seenOf(sel);
2306
2320
  setSeen(sel, !wasSeen);
2307
2321
  updateFlags(sel.accountId, sel.uid, sel.flags, sel.folderId).then(() => {
2308
- messageState.updateMessageFlags(sel.accountId, sel.uid, sel.flags);
2322
+ messageState.updateMessageFlags(sel.accountId, sel.uid, sel.flags, sel.folderId);
2309
2323
  const row = document.querySelector(`.ml-row[data-uid="${sel.uid}"][data-account-id="${sel.accountId}"]`);
2310
2324
  if (row)
2311
2325
  row.classList.toggle("unread", wasSeen);
@@ -6428,7 +6442,7 @@ document.addEventListener("mailx-popout-action", ((e) => {
6428
6442
  const wasFlagged = flaggedOf(msg);
6429
6443
  setFlagged(msg, !wasFlagged);
6430
6444
  updateFlags(accountId, msg.uid, msg.flags, msg.folderId).catch((err) => console.error(`[popout] flag failed: ${err?.message || err}`));
6431
- setRowFlagged(accountId, msg.uid, !wasFlagged);
6445
+ setRowFlagged(accountId, msg.uid, !wasFlagged, msg.folderId);
6432
6446
  }
6433
6447
  }));
6434
6448
  document.addEventListener("mailx-popout-message", (async (e) => {