@bobfrankston/mailx-imap 0.1.68 → 0.1.69
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/index.js +15 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1250,7 +1250,7 @@ export class ImapManager extends EventEmitter {
|
|
|
1250
1250
|
for (const m of qr.changedMessages) {
|
|
1251
1251
|
try {
|
|
1252
1252
|
const flagsArr = Array.from(m.flags || []).map(f => String(f));
|
|
1253
|
-
this.db.updateMessageFlags(accountId, m.uid, flagsArr);
|
|
1253
|
+
this.db.updateMessageFlags(accountId, folderId, m.uid, flagsArr);
|
|
1254
1254
|
}
|
|
1255
1255
|
catch { /* row may have just been VANISHED */ }
|
|
1256
1256
|
}
|
|
@@ -3467,6 +3467,12 @@ export class ImapManager extends EventEmitter {
|
|
|
3467
3467
|
// Delete previous draft — try UID first (fast path), and ALWAYS also try
|
|
3468
3468
|
// searchByHeader(X-Mailx-Draft-ID) as a safety net. Running both catches
|
|
3469
3469
|
// orphans from a crash-mid-save or a UID delete that failed silently.
|
|
3470
|
+
//
|
|
3471
|
+
// CRITICAL: also delete the LOCAL DB row for the superseded UID. Without
|
|
3472
|
+
// that, every checkpoint save left a stale row behind — IMAP had only
|
|
3473
|
+
// the latest copy but the local Drafts view rendered every past UID as
|
|
3474
|
+
// its own row, producing the "Drafts is flooded with droppings" symptom
|
|
3475
|
+
// (Bob 2026-05-27 — 8+ rows for a single in-progress reply).
|
|
3470
3476
|
if (previousDraftUid) {
|
|
3471
3477
|
try {
|
|
3472
3478
|
await client.deleteMessageByUid(drafts.path, previousDraftUid);
|
|
@@ -3474,6 +3480,10 @@ export class ImapManager extends EventEmitter {
|
|
|
3474
3480
|
catch (e) {
|
|
3475
3481
|
console.error(` [drafts] Delete prev UID ${previousDraftUid} failed: ${e.message}`);
|
|
3476
3482
|
}
|
|
3483
|
+
try {
|
|
3484
|
+
this.db.deleteMessage(accountId, drafts.id, previousDraftUid, "previous draft superseded", "saveDraft");
|
|
3485
|
+
}
|
|
3486
|
+
catch { /* */ }
|
|
3477
3487
|
}
|
|
3478
3488
|
if (draftId) {
|
|
3479
3489
|
try {
|
|
@@ -3483,6 +3493,10 @@ export class ImapManager extends EventEmitter {
|
|
|
3483
3493
|
await client.deleteMessageByUid(drafts.path, uid);
|
|
3484
3494
|
}
|
|
3485
3495
|
catch { /* next */ }
|
|
3496
|
+
try {
|
|
3497
|
+
this.db.deleteMessage(accountId, drafts.id, uid, `draft superseded by newer save (id=${draftId})`, "saveDraft");
|
|
3498
|
+
}
|
|
3499
|
+
catch { /* */ }
|
|
3486
3500
|
}
|
|
3487
3501
|
if (uids.length > 0)
|
|
3488
3502
|
console.log(` [drafts] Deleted ${uids.length} stale draft(s) by ID ${draftId}`);
|