@bobfrankston/rmfmail 1.2.85 → 1.2.86

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.
@@ -344,13 +344,13 @@ function deleteMessages(accountId, uids, folderIds) {
344
344
  return deleteMessage(accountId, uids[0], folderIds?.[0]);
345
345
  return ipc().deleteMessages?.(accountId, uids, folderIds);
346
346
  }
347
- function moveMessages(accountId, uids, targetFolderId, targetAccountId) {
347
+ function moveMessages(accountId, uids, targetFolderId, folderIds, targetAccountId) {
348
348
  if (uids.length === 1)
349
349
  return moveMessage(accountId, uids[0], targetFolderId, targetAccountId);
350
- return ipc().moveMessages?.(accountId, uids, targetFolderId, targetAccountId);
350
+ return ipc().moveMessages?.(accountId, uids, targetFolderId, folderIds);
351
351
  }
352
- function markAsSpamMessages(accountId, uids) {
353
- return ipc().markAsSpamMessages?.(accountId, uids);
352
+ function markAsSpamMessages(accountId, uids, folderIds) {
353
+ return ipc().markAsSpamMessages?.(accountId, uids, folderIds);
354
354
  }
355
355
  function copyMessages(accountId, uids, folderIds, targetFolderId) {
356
356
  return ipc().copyMessages?.(accountId, uids, folderIds, targetFolderId);
@@ -6827,7 +6827,8 @@ function renderNode(node, container, depth) {
6827
6827
  } else {
6828
6828
  const accountId = toMove[0].accountId;
6829
6829
  const uids = toMove.map((m) => m.uid);
6830
- moveMessages(accountId, uids, node.id).catch(onErr);
6830
+ const folderIds = toMove.map((m) => m.folderId);
6831
+ moveMessages(accountId, uids, node.id, folderIds).catch(onErr);
6831
6832
  }
6832
6833
  });
6833
6834
  }
@@ -8677,7 +8678,7 @@ document.addEventListener("mailx-flagged-batch", (e) => {
8677
8678
  }));
8678
8679
  for (const [src, g] of byAccount) {
8679
8680
  const targetAcct = src === targetAccount ? void 0 : targetAccount;
8680
- api.moveMessages(src, g.uids, targetFolderId, targetAcct)?.catch?.((err) => {
8681
+ api.moveMessages(src, g.uids, targetFolderId, g.folderIds, targetAcct)?.catch?.((err) => {
8681
8682
  if (status) status.textContent = `Move failed: ${err?.message || err}`;
8682
8683
  });
8683
8684
  }
@@ -8784,13 +8785,14 @@ async function spamSelectedMessages() {
8784
8785
  removeMessagesAndReconcile(selected);
8785
8786
  const byAccount = /* @__PURE__ */ new Map();
8786
8787
  for (const msg of snapshot) {
8787
- const uids = byAccount.get(msg.accountId) || [];
8788
- uids.push(msg.uid);
8789
- byAccount.set(msg.accountId, uids);
8788
+ const g = byAccount.get(msg.accountId) || { uids: [], folderIds: [] };
8789
+ g.uids.push(msg.uid);
8790
+ g.folderIds.push(msg.folderId);
8791
+ byAccount.set(msg.accountId, g);
8790
8792
  }
8791
8793
  if (statusSync) statusSync.textContent = `Spam: ${snapshot.length} queued \u2014 pending server sync`;
8792
- for (const [accountId, uids] of byAccount) {
8793
- markAsSpamMessages(accountId, uids).then((result) => {
8794
+ for (const [accountId, { uids, folderIds }] of byAccount) {
8795
+ markAsSpamMessages(accountId, uids, folderIds).then((result) => {
8794
8796
  console.log(`[spam] ${accountId}: moved ${result?.moved ?? uids.length} to folderId=${result?.targetFolderId}`);
8795
8797
  }).catch((e) => {
8796
8798
  console.error(`[spam] ${accountId} failed:`, e);