@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.
- package/client/app.bundle.js +24 -7
- package/client/app.bundle.js.map +2 -2
- package/client/app.js +42 -12
- package/client/app.js.map +1 -1
- package/client/app.ts +44 -13
- package/package.json +3 -3
- package/packages/mailx-imap/index.d.ts.map +1 -1
- package/packages/mailx-imap/index.js +15 -0
- package/packages/mailx-imap/index.js.map +1 -1
- package/packages/mailx-imap/index.ts +12 -0
- package/packages/mailx-imap/package-lock.json +2 -2
- package/packages/mailx-imap/package.json +1 -1
package/client/app.js
CHANGED
|
@@ -1490,6 +1490,28 @@ async function deleteSelectedMessages() {
|
|
|
1490
1490
|
return;
|
|
1491
1491
|
selected.push({ accountId: current.accountId, uid: current.message.uid, folderId: current.message.folderId });
|
|
1492
1492
|
}
|
|
1493
|
+
// Deleting a message that is ALREADY in Trash is a PERMANENT expunge, not
|
|
1494
|
+
// a move — the service's trashMessage returns "expunged" in that case. So
|
|
1495
|
+
// the prompt and the undo promise must change: permanent delete always
|
|
1496
|
+
// confirms (even a single message) and can't be undone (Bob 2026-06-12).
|
|
1497
|
+
const inTrash = currentFolderSpecialUse === "trash";
|
|
1498
|
+
// SAFETY GATE.
|
|
1499
|
+
// - In Trash: any delete is permanent → always confirm, warn it's final.
|
|
1500
|
+
// - Elsewhere: a single delete is instant (quick triage); a BULK delete
|
|
1501
|
+
// confirms, because `Ctrl+A` selects every visible row and in All
|
|
1502
|
+
// Inboxes that's a scattered screenful — exactly what silently trashed
|
|
1503
|
+
// 114 of Bob's messages on 2026-06-12.
|
|
1504
|
+
const n = selected.length;
|
|
1505
|
+
if (inTrash) {
|
|
1506
|
+
if (!confirm(`Permanently delete ${n} message${n === 1 ? "" : "s"} from Trash?\n\nThis cannot be undone.`)) {
|
|
1507
|
+
return;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
else if (n > 1) {
|
|
1511
|
+
if (!confirm(`Move ${n} messages to Trash?\n\n(Ctrl+Z restores them if this was a mistake.)`)) {
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1493
1515
|
const statusSync = document.getElementById("status-sync");
|
|
1494
1516
|
// Optimistic UI: remove from list IMMEDIATELY, then queue the IPC.
|
|
1495
1517
|
// Old order awaited the daemon round-trip (IPC + DB updates) before
|
|
@@ -1499,19 +1521,20 @@ async function deleteSelectedMessages() {
|
|
|
1499
1521
|
// re-populates the row and the catch block surfaces the error.
|
|
1500
1522
|
const snapshot = [...selected];
|
|
1501
1523
|
removeMessagesAndReconcile(selected);
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
// deletes only support undo for the first message today (consistent with
|
|
1505
|
-
// the previous single-slot semantics); the loop+push pattern can be
|
|
1506
|
-
// generalized later if Bob hits it.
|
|
1507
|
-
if (snapshot.length === 1) {
|
|
1508
|
-
pushUndo({ kind: "delete", at: Date.now(), payload: { ...snapshot[0], subject: "" } });
|
|
1524
|
+
if (inTrash) {
|
|
1525
|
+
// Permanent — no undo entry (there's nothing to restore to).
|
|
1509
1526
|
if (statusSync)
|
|
1510
|
-
statusSync.textContent = `
|
|
1527
|
+
statusSync.textContent = `Permanently deleted ${n} message${n === 1 ? "" : "s"}`;
|
|
1511
1528
|
}
|
|
1512
1529
|
else {
|
|
1530
|
+
// Undo restores the WHOLE batch, not just the first message — a bulk
|
|
1531
|
+
// delete must be fully recoverable via Ctrl+Z (the old single-slot undo
|
|
1532
|
+
// left the other N-1 unrecoverable; Bob 2026-06-12).
|
|
1533
|
+
pushUndo({ kind: "delete", at: Date.now(), payload: snapshot.map(m => ({ ...m, subject: "" })) });
|
|
1513
1534
|
if (statusSync)
|
|
1514
|
-
statusSync.textContent =
|
|
1535
|
+
statusSync.textContent = n === 1
|
|
1536
|
+
? `Trashed 1 message (syncing) — Ctrl+Z to undo`
|
|
1537
|
+
: `Trashed ${n} messages (syncing) — Ctrl+Z to undo`;
|
|
1515
1538
|
}
|
|
1516
1539
|
// Fire-and-forget per local-first: optimistic remove above already
|
|
1517
1540
|
// updated the UI; the daemon-side trash is sync DB + queued IMAP.
|
|
@@ -1544,10 +1567,17 @@ async function performUndo() {
|
|
|
1544
1567
|
const statusSync = document.getElementById("status-sync");
|
|
1545
1568
|
try {
|
|
1546
1569
|
if (op.kind === "delete") {
|
|
1547
|
-
|
|
1548
|
-
|
|
1570
|
+
// payload is the full batch (was a single object pre-2026-06-12;
|
|
1571
|
+
// tolerate both shapes so an in-flight undo from an old build
|
|
1572
|
+
// doesn't throw).
|
|
1573
|
+
const msgs = Array.isArray(op.payload) ? op.payload : [op.payload];
|
|
1574
|
+
for (const m of msgs) {
|
|
1575
|
+
await undeleteMessage(m.accountId, m.uid, m.folderId);
|
|
1576
|
+
}
|
|
1549
1577
|
if (statusSync)
|
|
1550
|
-
statusSync.textContent =
|
|
1578
|
+
statusSync.textContent = msgs.length === 1
|
|
1579
|
+
? "Message restored"
|
|
1580
|
+
: `Restored ${msgs.length} messages`;
|
|
1551
1581
|
}
|
|
1552
1582
|
else if (op.kind === "move") {
|
|
1553
1583
|
const { messages } = op.payload;
|