@bobfrankston/rmfmail 1.1.244 → 1.1.245

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.
@@ -8023,15 +8023,18 @@ async function deleteSelectedMessages() {
8023
8023
  if (!current) return;
8024
8024
  selected.push({ accountId: current.accountId, uid: current.message.uid, folderId: current.message.folderId });
8025
8025
  }
8026
+ if (selected.length > 1) {
8027
+ if (!confirm(`Move ${selected.length} messages to Trash?
8028
+
8029
+ (Ctrl+Z restores them if this was a mistake.)`)) {
8030
+ return;
8031
+ }
8032
+ }
8026
8033
  const statusSync = document.getElementById("status-sync");
8027
8034
  const snapshot = [...selected];
8028
8035
  removeMessagesAndReconcile(selected);
8029
- if (snapshot.length === 1) {
8030
- pushUndo({ kind: "delete", at: Date.now(), payload: { ...snapshot[0], subject: "" } });
8031
- if (statusSync) statusSync.textContent = `Trashed 1 message (syncing) \u2014 Ctrl+Z to undo`;
8032
- } else {
8033
- if (statusSync) statusSync.textContent = `Trashed ${snapshot.length} messages (syncing)`;
8034
- }
8036
+ pushUndo({ kind: "delete", at: Date.now(), payload: snapshot.map((m) => ({ ...m, subject: "" })) });
8037
+ if (statusSync) statusSync.textContent = snapshot.length === 1 ? `Trashed 1 message (syncing) \u2014 Ctrl+Z to undo` : `Trashed ${snapshot.length} messages (syncing) \u2014 Ctrl+Z to undo`;
8035
8038
  const byAccount = /* @__PURE__ */ new Map();
8036
8039
  for (const msg of snapshot) {
8037
8040
  const g = byAccount.get(msg.accountId) || { uids: [], folderIds: [] };
@@ -8052,9 +8055,11 @@ async function performUndo() {
8052
8055
  const statusSync = document.getElementById("status-sync");
8053
8056
  try {
8054
8057
  if (op.kind === "delete") {
8055
- const { accountId, uid, folderId } = op.payload;
8056
- await undeleteMessage(accountId, uid, folderId);
8057
- if (statusSync) statusSync.textContent = "Message restored";
8058
+ const msgs = Array.isArray(op.payload) ? op.payload : [op.payload];
8059
+ for (const m of msgs) {
8060
+ await undeleteMessage(m.accountId, m.uid, m.folderId);
8061
+ }
8062
+ if (statusSync) statusSync.textContent = msgs.length === 1 ? "Message restored" : `Restored ${msgs.length} messages`;
8058
8063
  } else if (op.kind === "move") {
8059
8064
  const { messages: messages2 } = op.payload;
8060
8065
  const byDest = /* @__PURE__ */ new Map();