fix: empty Trash for shared and group folders #387

This commit is contained in:
Linus Rath
2026-06-03 20:18:02 +02:00
parent 941fa15251
commit 44781f002c
4 changed files with 10 additions and 6 deletions
+4 -3
View File
@@ -1445,19 +1445,20 @@ export class JMAPClient implements IJMAPClient {
}
}
async emptyMailbox(mailboxId: string): Promise<number> {
async emptyMailbox(mailboxId: string, accountId?: string): Promise<number> {
const targetAccountId = accountId || this.accountId;
let totalDestroyed = 0;
let hasMore = true;
while (hasMore) {
const response = await this.request([
["Email/query", {
accountId: this.accountId,
accountId: targetAccountId,
filter: { inMailbox: mailboxId },
limit: 500,
}, "0"],
["Email/set", {
accountId: this.accountId,
accountId: targetAccountId,
"#destroy": { resultOf: "0", name: "Email/query", path: "/ids" },
}, "1"],
]);