@bobfrankston/rmfmail 1.1.244 → 1.1.246

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,14 +8023,29 @@ 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
+ const inTrash = currentFolderSpecialUse === "trash";
8027
+ const n = selected.length;
8028
+ if (inTrash) {
8029
+ if (!confirm(`Permanently delete ${n} message${n === 1 ? "" : "s"} from Trash?
8030
+
8031
+ This cannot be undone.`)) {
8032
+ return;
8033
+ }
8034
+ } else if (n > 1) {
8035
+ if (!confirm(`Move ${n} messages to Trash?
8036
+
8037
+ (Ctrl+Z restores them if this was a mistake.)`)) {
8038
+ return;
8039
+ }
8040
+ }
8026
8041
  const statusSync = document.getElementById("status-sync");
8027
8042
  const snapshot = [...selected];
8028
8043
  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`;
8044
+ if (inTrash) {
8045
+ if (statusSync) statusSync.textContent = `Permanently deleted ${n} message${n === 1 ? "" : "s"}`;
8032
8046
  } else {
8033
- if (statusSync) statusSync.textContent = `Trashed ${snapshot.length} messages (syncing)`;
8047
+ pushUndo({ kind: "delete", at: Date.now(), payload: snapshot.map((m) => ({ ...m, subject: "" })) });
8048
+ if (statusSync) statusSync.textContent = n === 1 ? `Trashed 1 message (syncing) \u2014 Ctrl+Z to undo` : `Trashed ${n} messages (syncing) \u2014 Ctrl+Z to undo`;
8034
8049
  }
8035
8050
  const byAccount = /* @__PURE__ */ new Map();
8036
8051
  for (const msg of snapshot) {
@@ -8052,9 +8067,11 @@ async function performUndo() {
8052
8067
  const statusSync = document.getElementById("status-sync");
8053
8068
  try {
8054
8069
  if (op.kind === "delete") {
8055
- const { accountId, uid, folderId } = op.payload;
8056
- await undeleteMessage(accountId, uid, folderId);
8057
- if (statusSync) statusSync.textContent = "Message restored";
8070
+ const msgs = Array.isArray(op.payload) ? op.payload : [op.payload];
8071
+ for (const m of msgs) {
8072
+ await undeleteMessage(m.accountId, m.uid, m.folderId);
8073
+ }
8074
+ if (statusSync) statusSync.textContent = msgs.length === 1 ? "Message restored" : `Restored ${msgs.length} messages`;
8058
8075
  } else if (op.kind === "move") {
8059
8076
  const { messages: messages2 } = op.payload;
8060
8077
  const byDest = /* @__PURE__ */ new Map();