Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Train fix for #5348: email codes fall back to the inbox line when Gmail is already connected

milind-sonia87a9bd61ec4
diff --git a/server/host/connector-cards.ts b/server/host/connector-cards.ts
index 6d718b9866..be02de2781 100644
--- a/server/host/connector-cards.ts
+++ b/server/host/connector-cards.ts
@@ -21,7 +21,7 @@ export interface ConnectorCardsDeps {
maybeResume(threadId: string, resumeKey: string): void;
}
-export type ConnectorCardAnswer = { status: 200; body: { messageIds: string[]; authConfigNote?: string; connectedNote?: string } } | { status: 400 | 403 | 409; body: { error: string } };
+export type ConnectorCardAnswer = { status: 200; body: { messageIds: string[]; authConfigNote?: string; connectedNote?: string; nothingToSignIn?: boolean } } | { status: 400 | 403 | 409; body: { error: string } };
export function createConnectorCards(deps: ConnectorCardsDeps) {
async function request(capability: Capability, input: { botId?: unknown; threadId?: unknown; resumeKey?: unknown; items?: unknown; slugs?: unknown }, requireActive: () => void): Promise<ConnectorCardAnswer> {
diff --git a/server/host/login-mail-codes.ts b/server/host/login-mail-codes.ts
index b1b3460065..544f131bc8 100644
--- a/server/host/login-mail-codes.ts
+++ b/server/host/login-mail-codes.ts
@@ -154,7 +154,7 @@ export function createLoginMailCodes(deps: LoginMailCodesDeps) {
}
};
const answer = await deps.connectCard(turn, { botId: bot.id, threadId: turn.threadId, items: ["gmail"], resumeKey: randomUUID() });
- if (answer.status === 200) { remember(); return { shown: true }; }
+ if (answer.status === 200) { remember(); return answer.body.nothingToSignIn ? { shown: false } : { shown: true }; }
if (answer.status === 409 && onTeam) {
if (person) remember();
return { shown: false, line: answer.body.error };