@bobfrankston/rmfmail 1.2.216 → 1.2.217
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 +14 -14
- package/client/app.bundle.js.map +3 -3
- package/client/app.js +20 -15
- package/client/app.js.map +1 -1
- package/client/app.ts +19 -13
- package/client/compose/compose.bundle.js +2 -1
- package/client/compose/compose.bundle.js.map +2 -2
- package/client/lib/api-client.js +7 -2
- package/client/lib/api-client.js.map +1 -1
- package/client/lib/api-client.ts +7 -1
- package/package.json +1 -1
- /package/packages/mailx-imap/{node_modules.npmglobalize-stash-25568 → node_modules.npmglobalize-stash-36516}/.package-lock.json +0 -0
package/client/app.js
CHANGED
|
@@ -1833,7 +1833,7 @@ async function performUndo() {
|
|
|
1833
1833
|
}
|
|
1834
1834
|
}
|
|
1835
1835
|
else if (op.kind === "move") {
|
|
1836
|
-
const { messages } = op.payload;
|
|
1836
|
+
const { messages, targetFolderId } = op.payload;
|
|
1837
1837
|
const byDest = new Map();
|
|
1838
1838
|
for (const m of messages) {
|
|
1839
1839
|
const key = `${m.accountId}:${m.sourceFolderId}`;
|
|
@@ -1841,12 +1841,15 @@ async function performUndo() {
|
|
|
1841
1841
|
byDest.set(key, { accountId: m.accountId, folderId: m.sourceFolderId, uids: [] });
|
|
1842
1842
|
byDest.get(key).uids.push(m.uid);
|
|
1843
1843
|
}
|
|
1844
|
-
const { moveMessages
|
|
1844
|
+
const { moveMessages } = await import("./lib/api-client.js");
|
|
1845
1845
|
for (const group of byDest.values()) {
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1846
|
+
// The messages are sitting in targetFolderId right now, so that
|
|
1847
|
+
// is their SOURCE for the reverse move — pass it explicitly.
|
|
1848
|
+
// Without it the service resolves each row by (account, uid)
|
|
1849
|
+
// alone and a same-numbered uid in another folder can be moved
|
|
1850
|
+
// instead (the flag-clear / spam-move wrong-folder class).
|
|
1851
|
+
const currentFolderIds = targetFolderId ? group.uids.map(() => targetFolderId) : undefined;
|
|
1852
|
+
await moveMessages(group.accountId, group.uids, group.folderId, currentFolderIds);
|
|
1850
1853
|
}
|
|
1851
1854
|
if (statusSync)
|
|
1852
1855
|
statusSync.textContent = `Undid move of ${messages.length} message${messages.length !== 1 ? "s" : ""}${remaining}`;
|
|
@@ -2192,21 +2195,23 @@ async function spamSelectedMessages() {
|
|
|
2192
2195
|
// performUndo restores each message to its own sourceFolderId, so a
|
|
2193
2196
|
// selection spanning folders comes back correctly; targetFolderId is only
|
|
2194
2197
|
// known once the service answers and the undo doesn't need it.
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
targetFolderId: 0,
|
|
2202
|
-
},
|
|
2203
|
-
});
|
|
2198
|
+
const spamUndo = {
|
|
2199
|
+
messages: snapshot.map(m => ({ accountId: m.accountId, uid: m.uid, sourceFolderId: m.folderId })),
|
|
2200
|
+
targetAccountId: snapshot[0].accountId,
|
|
2201
|
+
targetFolderId: 0, // filled in below — only the service knows which folder is \Junk
|
|
2202
|
+
};
|
|
2203
|
+
pushUndo({ kind: "move", at: Date.now(), payload: spamUndo });
|
|
2204
2204
|
if (statusSync)
|
|
2205
2205
|
statusSync.textContent = `Spam: ${snapshot.length} queued — Ctrl+Z to undo`;
|
|
2206
2206
|
for (const [accountId, { uids, folderIds }] of byAccount) {
|
|
2207
2207
|
markAsSpamMessages(accountId, uids, folderIds)
|
|
2208
2208
|
.then(result => {
|
|
2209
2209
|
console.log(`[spam] ${accountId}: moved ${result?.moved ?? uids.length} to folderId=${result?.targetFolderId}`);
|
|
2210
|
+
// Now we know where they landed. The undo op is still on the
|
|
2211
|
+
// stack (same object) — record it so the reverse move names the
|
|
2212
|
+
// messages' current folder instead of guessing by uid alone.
|
|
2213
|
+
if (result?.targetFolderId)
|
|
2214
|
+
spamUndo.targetFolderId = result.targetFolderId;
|
|
2210
2215
|
})
|
|
2211
2216
|
.catch(e => {
|
|
2212
2217
|
console.error(`[spam] ${accountId} failed:`, e);
|