email: store emails.db per account under email_accounts/<account>/
Reorganizes email storage: the DB moves from DATA_PATH/<user>/emails.db to DATA_PATH/<user>/email_accounts/<accountEmail>/emails.db, with a shared email_accounts/attachment_cache/ (was Gmail/emails/attachments). openEmailDb now takes (owner, account); a new openUserEmailDb(owner, userId) resolves the user's configured account (first enabled) for read paths. Threads the account through email.ts, accounts, resync, queue sync, channel handlers, and the email_db MCP tool path. Drops the dead getUserEmailDir helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -52,7 +52,12 @@ export const getTmpAttachmentsDir = (email: string) => join(DATA_PATH, email, 'a
|
||||
|
||||
export const getAttachmentsDir = (email: string, sessionId: string) => join(DATA_PATH, email, 'attachments', sessionId);
|
||||
|
||||
export const getUserEmailDir = (email: string) => join(DATA_PATH, email, 'Gmail', 'emails');
|
||||
// Per-account email storage: DATA_PATH/<owner>/email_accounts/<accountEmail>/emails.db, with a
|
||||
// single attachment_cache/ shared across the owner's accounts.
|
||||
export const getEmailAccountsDir = (ownerEmail: string) => join(DATA_PATH, ownerEmail, 'email_accounts');
|
||||
export const getEmailDbPath = (ownerEmail: string, accountEmail: string) =>
|
||||
join(getEmailAccountsDir(ownerEmail), accountEmail, 'emails.db');
|
||||
export const getEmailAttachmentCacheDir = (ownerEmail: string) => join(getEmailAccountsDir(ownerEmail), 'attachment_cache');
|
||||
|
||||
/** Derive a valid Linux username from a display username or email. */
|
||||
export const toShellUsername = (username: string, email: string): string => {
|
||||
|
||||
Reference in New Issue
Block a user