Feature: recipient autocomplete from Sent, with on-demand server search
Compose recipient fields only suggested existing contacts and directory users, so people you had emailed before but never saved as a contact never came up. This adds an Outlook-Web-style suggestion flow. On startup the Sent folder is read once (metadata only) to build a cache of addresses you have written to; those are merged into the autocomplete after contacts and directory principals, deduped, contacts winning. When the recipient is not in the cache, the dropdown offers a "search the server" row that queries the Sent folder on demand. That lookup fetches only the to/cc fields (no subject, body or attachments) and returns the matching addresses, deduped. New strings are added to all 20 locales.
This commit is contained in:
@@ -209,6 +209,23 @@ export class DemoJMAPClient implements IJMAPClient {
|
||||
return { emails, hasMore: position + limit < total, total };
|
||||
}
|
||||
|
||||
async searchSentRecipients(query: string, _sentMailboxId: string, _accountId?: string, _limit: number = 60): Promise<Array<{ name: string; email: string }>> {
|
||||
const q = query.trim().toLowerCase();
|
||||
if (!q) return [];
|
||||
const byEmail = new Map<string, { name: string; email: string }>();
|
||||
for (const email of this.data.emails) {
|
||||
for (const r of [...(email.to || []), ...(email.cc || [])]) {
|
||||
if (!r.email) continue;
|
||||
const key = r.email.toLowerCase();
|
||||
if (byEmail.has(key)) continue;
|
||||
if (key.includes(q) || (r.name && r.name.toLowerCase().includes(q))) {
|
||||
byEmail.set(key, { name: r.name || '', email: r.email });
|
||||
}
|
||||
}
|
||||
}
|
||||
return Array.from(byEmail.values());
|
||||
}
|
||||
|
||||
// ── Email mutations ───────────────────────────────────────────
|
||||
|
||||
async markAsRead(emailId: string, read: boolean = true): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user