diff options
| author | Frank <[email protected]> | 2025-10-10 21:21:55 -0400 |
|---|---|---|
| committer | Frank <[email protected]> | 2025-10-10 21:21:55 -0400 |
| commit | c7dfbbeed0e7b5a7421b4b0d8c115a24f5ba7534 (patch) | |
| tree | 4c3b1bc79686c8d448de45f7aea4569c4f5b1a1c /packages/console/core/src/user.ts | |
| parent | b946fd21b18184a61a2d62e073a18a0850866801 (diff) | |
| download | opencode-c7dfbbeed0e7b5a7421b4b0d8c115a24f5ba7534.tar.gz opencode-c7dfbbeed0e7b5a7421b4b0d8c115a24f5ba7534.zip | |
wip: zen
Diffstat (limited to 'packages/console/core/src/user.ts')
| -rw-r--r-- | packages/console/core/src/user.ts | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/console/core/src/user.ts b/packages/console/core/src/user.ts index 63877150e..40d74f93d 100644 --- a/packages/console/core/src/user.ts +++ b/packages/console/core/src/user.ts @@ -11,6 +11,7 @@ import { Account } from "./account" import { AccountTable } from "./schema/account.sql" import { Key } from "./key" import { KeyTable } from "./schema/key.sql" +import { WorkspaceTable } from "./schema/workspace.sql" export namespace User { const assertNotSelf = (id: string) => { @@ -115,6 +116,21 @@ export namespace User { // send email, ignore errors try { + const emailInfo = await Database.use((tx) => + tx + .select({ + email: AccountTable.email, + workspaceName: WorkspaceTable.name, + }) + .from(UserTable) + .innerJoin(AccountTable, eq(UserTable.accountID, AccountTable.id)) + .innerJoin(WorkspaceTable, eq(WorkspaceTable.id, workspaceID)) + .where( + and(eq(UserTable.workspaceID, workspaceID), eq(UserTable.id, Actor.assert("user").properties.userID)), + ) + .then((rows) => rows[0]), + ) + const { InviteEmail } = await import("@opencode-ai/console-mail/InviteEmail.jsx") await AWS.sendEmail({ to: email, @@ -122,8 +138,10 @@ export namespace User { body: render( // @ts-ignore InviteEmail({ + inviter: emailInfo.email, assetsUrl: `https://opencode.ai/email`, - workspace: workspaceID, + workspaceID: workspaceID, + workspaceName: emailInfo.workspaceName, }), ), }) |
