@bobfrankston/rmfmail 1.0.694 → 1.0.695

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.
@@ -3314,12 +3314,18 @@ var init_message_list = __esm({
3314
3314
  const pick = await pickFolder(accountId, { excludeFolderIds: [msg.folderId] });
3315
3315
  if (!pick)
3316
3316
  return;
3317
- try {
3318
- await moveMessages(accountId, uids, pick.folderId);
3319
- removeMessagesAndReconcile(uids.map((u) => ({ accountId, uid: u })));
3320
- } catch (err) {
3321
- alert(`Move failed: ${err.message}`);
3322
- }
3317
+ removeMessagesAndReconcile(uids.map((u) => ({ accountId, uid: u })));
3318
+ const statusSync = document.getElementById("status-sync");
3319
+ if (statusSync)
3320
+ statusSync.textContent = `Moving ${uids.length} message${uids.length !== 1 ? "s" : ""} to ${pick.folderName}\u2026`;
3321
+ moveMessages(accountId, uids, pick.folderId).then(() => {
3322
+ if (statusSync)
3323
+ statusSync.textContent = `Moved ${uids.length} to ${pick.folderName}`;
3324
+ }).catch((err) => {
3325
+ console.error(`Move failed: ${err?.message || err}`);
3326
+ if (statusSync)
3327
+ statusSync.textContent = `Move sync issue: ${err?.message || err}`;
3328
+ });
3323
3329
  }
3324
3330
  },
3325
3331
  { label: "Delete", action: () => document.dispatchEvent(new CustomEvent("mailx-delete")) },
@@ -6709,24 +6715,20 @@ async function spamSelectedMessages() {
6709
6715
  const statusSync = document.getElementById("status-sync");
6710
6716
  const snapshot = [...selected];
6711
6717
  removeMessagesAndReconcile(selected);
6712
- try {
6713
- const byAccount = /* @__PURE__ */ new Map();
6714
- for (const msg of snapshot) {
6715
- const uids = byAccount.get(msg.accountId) || [];
6716
- uids.push(msg.uid);
6717
- byAccount.set(msg.accountId, uids);
6718
- }
6719
- for (const [accountId, uids] of byAccount) {
6720
- const result = await markAsSpamMessages(accountId, uids);
6718
+ const byAccount = /* @__PURE__ */ new Map();
6719
+ for (const msg of snapshot) {
6720
+ const uids = byAccount.get(msg.accountId) || [];
6721
+ uids.push(msg.uid);
6722
+ byAccount.set(msg.accountId, uids);
6723
+ }
6724
+ if (statusSync) statusSync.textContent = `Spam: ${snapshot.length} queued \u2014 pending server sync`;
6725
+ for (const [accountId, uids] of byAccount) {
6726
+ markAsSpamMessages(accountId, uids).then((result) => {
6721
6727
  console.log(`[spam] ${accountId}: moved ${result?.moved ?? uids.length} to folderId=${result?.targetFolderId}`);
6722
- }
6723
- if (statusSync) statusSync.textContent = `Spam: ${snapshot.length} queued \u2014 pending server sync`;
6724
- } catch (e) {
6725
- console.error(`[spam] failed:`, e);
6726
- if (statusSync) statusSync.textContent = `Spam failed: ${e?.message || e}`;
6727
- alert(`Mark-as-spam failed: ${e?.message || e}
6728
-
6729
- ${selected.length} message(s) stayed in the list; check Settings \u2192 account spam folder and accounts.jsonc.`);
6728
+ }).catch((e) => {
6729
+ console.error(`[spam] ${accountId} failed:`, e);
6730
+ if (statusSync) statusSync.textContent = `Spam sync issue (${accountId}): ${e?.message || e}`;
6731
+ });
6730
6732
  }
6731
6733
  }
6732
6734
  document.getElementById("btn-spam")?.addEventListener("click", spamSelectedMessages);