feat: add onEmailsFetched and onSearchResults hook + new JMAP method getSomeEmails

This commit is contained in:
Paulhenry Saux
2026-07-13 18:18:57 +02:00
committed by Linus Rath
parent c1acf58c5f
commit 622adc34de
5 changed files with 154 additions and 81 deletions
+13
View File
@@ -166,6 +166,19 @@ export class DemoJMAPClient implements IJMAPClient {
return { emails, hasMore: position + limit < total, total };
}
async getSomeEmails(emailsId: string[], _accountId?: string): Promise<Email[]> {
if (!emailsId || emailsId.length === 0) {
return [];
}
const filtered = this.data.emails.filter(e => emailsId.includes(e.id));
filtered.sort((a, b) =>
new Date(b.receivedAt).getTime() - new Date(a.receivedAt).getTime()
);
return filtered;
}
async getEmailsInMailbox(mailboxId: string): Promise<Email[]> {
return this.data.emails.filter(e => e.mailboxIds[mailboxId]);
}