Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix: show an Outlook identity as the sign-in name, not a mailbox

shoudi zheng3d7ca3d16950
diff --git a/apps/teamhub-cli/src/apps-auto-reminders.test.ts b/apps/teamhub-cli/src/apps-auto-reminders.test.ts
index b64a5643..627be854 100644
--- a/apps/teamhub-cli/src/apps-auto-reminders.test.ts
+++ b/apps/teamhub-cli/src/apps-auto-reminders.test.ts
@@ -35,6 +35,27 @@ const gmail = {
};
describe("apps auto-reminders", () => {
+ it("marks an Outlook connection as the Microsoft sign-in name", async () => {
+ const f = fixture({
+ connections: [
+ {
+ ...gmail,
+ connection_id: "connection_outlook",
+ app_key: "outlook",
+ identity_label: "[email protected]",
+ },
+ gmail,
+ ],
+ });
+ expect(await runCli(["apps", "auto-reminders", "list"], f.deps)).toBe(0);
+ const text = f.output.join("");
+ expect(text).toContain(
+ "connection_outlook outlook [email protected] - Microsoft sign-in name, the mailbox address may differ auto reminders on",
+ );
+ expect(text).toContain(
+ "connection_gmail gmail [email protected] auto reminders on",
+ );
+ });
it("lists the Sponsor's switchable connections", async () => {
const f = fixture({ connections: [gmail] });
expect(await runCli(["apps", "auto-reminders", "list"], f.deps)).toBe(0);
diff --git a/apps/teamhub-cli/src/apps-connect.test.ts b/apps/teamhub-cli/src/apps-connect.test.ts
index 0ae202af..1bcab4bc 100644
--- a/apps/teamhub-cli/src/apps-connect.test.ts
+++ b/apps/teamhub-cli/src/apps-connect.test.ts
@@ -75,6 +75,35 @@ describe("apps connect", () => {
expect(text).toContain("authorization_required");
expect(text).toContain("Authorization card: message_card");
});
+ it("renders an Outlook account as the Microsoft sign-in name", async () => {
+ const f = fixture({
+ status: "ready",
+ account: {
+ connection_id: "c1",
+ identity_label: "a@b",
+ app_key: "outlook",
+ },
+ });
+ expect(await runCli(["apps", "connect", "outlook"], f.deps)).toBe(0);
+ expect(f.output.join("")).toContain(
+ "Connected: c1 (a@b - Microsoft sign-in name, the mailbox address may differ)",
+ );
+ });
+ it("marks only Outlook candidates as sign-in names", async () => {
+ const f = fixture({
+ status: "account_ambiguous",
+ candidates: [
+ { connection_id: "c2", identity_label: "w@x", app_key: "outlook" },
+ { connection_id: "c3", identity_label: "g@x", app_key: "gmail" },
+ ],
+ });
+ expect(await runCli(["apps", "connect", "outlook"], f.deps)).not.toBe(0);
+ const text = f.errors.join("");
+ expect(text).toContain(
+ "Account: c2 w@x - Microsoft sign-in name, the mailbox address may differ",
+ );
+ expect(text).toMatch(/Account: c3 {2}g@x$/m);
+ });
it("reports ambiguous accounts with candidates", async () => {
const f = fixture({
status: "account_ambiguous",
diff --git a/apps/teamhub-cli/src/business-commands.ts b/apps/teamhub-cli/src/business-commands.ts
index 6afdce95..d69f1061 100644
--- a/apps/teamhub-cli/src/business-commands.ts
+++ b/apps/teamhub-cli/src/business-commands.ts
@@ -24,7 +24,7 @@ import {
validateAccountSelector,
} from "./connector-runtime.js";
import { renderBusinessResult } from "./business-render.js";
-import { displayText } from "./display-text.js";
+import { accountIdentityText, displayText } from "./display-text.js";
import { computerPermissionCommandDefinitions } from "./computer-permission-commands.js";
type Json = Record<string, unknown>;
@@ -346,7 +346,7 @@ const appsConnect: CommandDefinition = {
}),
render: (result) => {
const account = result.account as Json;
- return `Connected: ${singleLineText(account.connection_id)} (${singleLineText(account.identity_label ?? account.display_name)})`;
+ return `Connected: ${singleLineText(account.connection_id)} (${singleLineText(accountIdentityText(account.app_key, account.identity_label) || account.display_name)})`;
},
};
const browserConnect: CommandDefinition = {
@@ -408,7 +408,7 @@ const autoRemindersItem = {
required: ["connection_id", "app_key", "identity_label", "status", "enabled"],
};
const autoRemindersLine = (item: Json): string =>
- `${singleLineText(item.connection_id)} ${singleLineText(item.app_key)} ${singleLineText(item.identity_label)} auto reminders ${item.enabled ? "on" : "off"}`;
+ `${singleLineText(item.connection_id)} ${singleLineText(item.app_key)} ${singleLineText(accountIdentityText(item.app_key, item.identity_label))} auto reminders ${item.enabled ? "on" : "off"}`;
const autoRemindersNote =
"Auto reminders let AnotherMe watch the Human's Gmail, Outlook, Google Calendar or Slack and remind them of things that need attention. Only Another Me can use it, and only for connections its own Human owns.";
const appsAutoRemindersList: CommandDefinition = {
diff --git a/apps/teamhub-cli/src/business-render.ts b/apps/teamhub-cli/src/business-render.ts
index 6a582508..7a771dc3 100644
--- a/apps/teamhub-cli/src/business-render.ts
+++ b/apps/teamhub-cli/src/business-render.ts
@@ -1,4 +1,4 @@
-import { displayText } from "./display-text.js";
+import { accountIdentityText, displayText } from "./display-text.js";
type Json = Record<string, unknown>;
const singleLine = (value: unknown): string =>
@@ -271,7 +271,10 @@ export function renderBusinessResult(command: string, result: Json): string {
if (command === "apps list")
return list(
"connection",
- result.connections as Json[],
+ (result.connections as Json[]).map((item) => ({
+ ...item,
+ identityLabel: accountIdentityText(item.name, item.identityLabel),
+ })),
[
["CONNECTION ID", "connectionId"],
["NAME", "name"],
diff --git a/apps/teamhub-cli/src/command-errors.ts b/apps/teamhub-cli/src/command-errors.ts
index 7824ad8e..e33ba41a 100644
--- a/apps/teamhub-cli/src/command-errors.ts
+++ b/apps/teamhub-cli/src/command-errors.ts
@@ -1,6 +1,6 @@
import type { CommandTarget } from "./command-definition.js";
import { CliError } from "./errors.js";
-import { displayText } from "./display-text.js";
+import { accountIdentityText, displayText } from "./display-text.js";
export interface CommandError {
code: string;
@@ -150,7 +150,7 @@ export function renderCommandError(error: CommandError): string {
: []
).map(
(item: Record<string, unknown>) =>
- `Account: ${singleLine(displayText(item.connection_id ?? ""))} ${singleLine(displayText(item.identity_label ?? ""))}`,
+ `Account: ${singleLine(displayText(item.connection_id ?? ""))} ${singleLine(accountIdentityText(item.app_key, item.identity_label))}`,
),
...(Array.isArray(error.details?.issues) ? error.details.issues : []).map(
(issue: Record<string, unknown>) =>
diff --git a/apps/teamhub-cli/src/connector-account-line.test.ts b/apps/teamhub-cli/src/connector-account-line.test.ts
new file mode 100644
index 00000000..0d82d24b
--- /dev/null
+++ b/apps/teamhub-cli/src/connector-account-line.test.ts
@@ -0,0 +1,55 @@
+import { expect, it } from "vitest";
+
+import { renderBusinessResult } from "./business-render.js";
+import { renderConnectorResult } from "./connector-runtime.js";
+
+const result = (name: string, identityLabel: string) => ({
+ account: {
+ connectionId: "external_connection_one",
+ name,
+ displayName: name,
+ identityLabel,
+ },
+ result: {},
+});
+
+it("marks an Outlook label as the sign-in name, not the mailbox", () => {
+ expect(
+ renderConnectorResult(result("outlook", "[email protected]")).split("\n")[0],
+ ).toBe(
+ "Account: [email protected] - Microsoft sign-in name, the mailbox address may differ (external_connection_one)",
+ );
+});
+
+it("prints another provider's identity label as it is", () => {
+ expect(
+ renderConnectorResult(result("gmail", "[email protected]")).split("\n")[0],
+ ).toBe("Account: [email protected] (external_connection_one)");
+});
+
+it("marks only Outlook identities in the apps list", () => {
+ const lines = renderBusinessResult("apps list", {
+ connections: [
+ {
+ connectionId: "external_connection_one",
+ name: "outlook",
+ displayName: "Outlook Mail",
+ identityLabel: "[email protected]",
+ },
+ {
+ connectionId: "external_connection_two",
+ name: "gmail",
+ displayName: "Gmail",
+ identityLabel: "[email protected]",
+ },
+ ],
+ }).split("\n");
+ expect(
+ lines.find((line) => line.includes("external_connection_one")),
+ ).toContain(
+ "[email protected] - Microsoft sign-in name, the mailbox address may differ",
+ );
+ const gmail = lines.find((line) => line.includes("external_connection_two"));
+ expect(gmail).toContain("[email protected]");
+ expect(gmail).not.toContain("Microsoft sign-in name");
+});
diff --git a/apps/teamhub-cli/src/connector-runtime.ts b/apps/teamhub-cli/src/connector-runtime.ts
index 857642d3..cfcc6e9c 100644
--- a/apps/teamhub-cli/src/connector-runtime.ts
+++ b/apps/teamhub-cli/src/connector-runtime.ts
@@ -18,7 +18,7 @@ import { connectorWriteApproval } from "./connector-approval.js";
import { id, object, rootSchema } from "./connector-schemas.js";
import { CliError, ConnectorError } from "./errors.js";
import type { ConnectorFile } from "./connector-files.js";
-import { displayText } from "./display-text.js";
+import { accountIdentityText, displayText } from "./display-text.js";
export type Json = Record<string, unknown>;
export interface ConnectorBinding {
@@ -757,7 +757,7 @@ function label(key: string): string {
export function renderConnectorResult(result: Json): string {
const account = record(result.account);
const lines = [
- `Account: ${clean(account.identityLabel || account.displayName)} (${clean(account.connectionId)})`,
+ `Account: ${clean(accountIdentityText(account.name, account.identityLabel) || account.displayName)} (${clean(account.connectionId)})`,
];
const submitted = record(result.result ?? {});
if (submitted.action === "confirmation_requested") {
diff --git a/apps/teamhub-cli/src/display-text.ts b/apps/teamhub-cli/src/display-text.ts
index ae113ce2..7cccea19 100644
--- a/apps/teamhub-cli/src/display-text.ts
+++ b/apps/teamhub-cli/src/display-text.ts
@@ -5,3 +5,19 @@ export const displayText = (value: unknown): string => {
if (typeof value === "object" && value !== null) return JSON.stringify(value);
return String(value);
};
+
+/**
+ * An account's identity label as Agent-readable text, empty when there is no
+ * label. An Outlook label is the Microsoft account's sign-in name, which can
+ * belong to another mail provider, so it must not be read as the mailbox.
+ */
+export const accountIdentityText = (
+ appKey: unknown,
+ label: unknown,
+): string => {
+ if (label === undefined || label === null || label === "") return "";
+ const text = displayText(label);
+ return appKey === "outlook"
+ ? `${text} - Microsoft sign-in name, the mailbox address may differ`
+ : text;
+};
diff --git a/apps/teamhub/internal/proactive/event.go b/apps/teamhub/internal/proactive/event.go
index cbedf821..b440a2bc 100644
--- a/apps/teamhub/internal/proactive/event.go
+++ b/apps/teamhub/internal/proactive/event.go
@@ -272,6 +272,12 @@ func eventText(label string, event Event, accountLabel string) string {
if event.Grant != nil {
if accountLabel != "" {
facts = append(facts, "account: "+accountLabel)
+ // An Outlook label is the Microsoft account's sign-in name, which can
+ // belong to another mail provider; the account value itself stays
+ // exact so it can be passed to --account.
+ if event.Source == "outlook" {
+ facts = append(facts, "account note: Microsoft sign-in name, the mailbox address may differ")
+ }
}
facts = append(facts, "connection: "+event.Grant.ConnectionID)
}
diff --git a/apps/teamhub/internal/proactive/event_test.go b/apps/teamhub/internal/proactive/event_test.go
index c6f30f9f..120f4e32 100644
--- a/apps/teamhub/internal/proactive/event_test.go
+++ b/apps/teamhub/internal/proactive/event_test.go
@@ -60,12 +60,16 @@ func TestEventWakeFencesOutsideData(t *testing.T) {
func TestEventWakeNamesTheGrantedAccount(t *testing.T) {
event := Event{Source: "outlook", Kind: "new_mail", Summary: "Hello",
Grant: &reminder.GrantReference{ID: "g", Revision: 1, ConnectionID: "external_connection_abc"}}
- if text := eventText("[e]", event, "[email protected]"); !strings.HasPrefix(text, "[e]\nsource: outlook; kind: new_mail; account: [email protected]; connection: external_connection_abc\n") {
+ if text := eventText("[e]", event, "[email protected]"); !strings.HasPrefix(text, "[e]\nsource: outlook; kind: new_mail; account: [email protected]; account note: Microsoft sign-in name, the mailbox address may differ; connection: external_connection_abc\n") {
t.Fatalf("wake text=%q", text)
}
if text := eventText("[e]", event, ""); !strings.HasPrefix(text, "[e]\nsource: outlook; kind: new_mail; connection: external_connection_abc\n") {
t.Fatalf("wake text without a label=%q", text)
}
+ event.Source = "gmail"
+ if text := eventText("[e]", event, "[email protected]"); !strings.HasPrefix(text, "[e]\nsource: gmail; kind: new_mail; account: [email protected]; connection: external_connection_abc\n") {
+ t.Fatalf("gmail wake text=%q", text)
+ }
}
func TestAgentEventJudgeSendsTheHumansRulesAndOpenItems(t *testing.T) {
diff --git a/apps/web/src/features/apps/agent-connectors.tsx b/apps/web/src/features/apps/agent-connectors.tsx
index 3e1ad607..14da5cb8 100644
--- a/apps/web/src/features/apps/agent-connectors.tsx
+++ b/apps/web/src/features/apps/agent-connectors.tsx
@@ -20,7 +20,10 @@ import type {
TeamHubExternalConnection,
} from "@/features/teamhub/teamhub-types";
import { AppLogo } from "./app-logo";
-import { establishedExternalConnections } from "./connection-state";
+import {
+ establishedExternalConnections,
+ accountIdentityText,
+} from "./connection-state";
import {
externalAppsQueryOptions,
externalConnectionsQueryOptions,
@@ -181,7 +184,7 @@ function AgentConnectionAccess({
) : access.data && !agent ? (
"Access unavailable for this Agent"
) : (
- connection.identity_label || undefined
+ accountIdentityText(connection.provider, connection.identity_label)
);
return (
<SettingsRow
diff --git a/apps/web/src/features/apps/app-manage-dialog.tsx b/apps/web/src/features/apps/app-manage-dialog.tsx
index 1f4a9153..9fee5fe1 100644
--- a/apps/web/src/features/apps/app-manage-dialog.tsx
+++ b/apps/web/src/features/apps/app-manage-dialog.tsx
@@ -27,6 +27,7 @@ import {
establishedExternalConnections,
externalConnectionNeedsAttention,
openPendingExternalConnection,
+ accountIdentityText,
} from "./connection-state";
export function AppManageDialog({
@@ -161,7 +162,10 @@ function ConnectionRow({
<div className="flex min-h-[58px] flex-wrap items-center gap-3 py-2.5">
<div className="min-w-[180px] flex-1">
<p className="truncate text-sm font-medium text-foreground">
- {connection.identity_label ?? "Authorization in progress"}
+ {accountIdentityText(
+ connection.provider,
+ connection.identity_label,
+ ) ?? "Authorization in progress"}
</p>
<div className="mt-1 flex flex-wrap items-center gap-2">
{needsReconnecting ? (
@@ -330,7 +334,10 @@ export function DisconnectConnectionDialog({
return (
<ModalDialog
- description={connection.identity_label ?? connection.provider}
+ description={
+ accountIdentityText(connection.provider, connection.identity_label) ??
+ connection.provider
+ }
onClose={onClose}
size="md"
title="Disconnect account?"
diff --git a/apps/web/src/features/apps/connected-apps-page.test.tsx b/apps/web/src/features/apps/connected-apps-page.test.tsx
index 04c56c9c..f00a4bb6 100644
--- a/apps/web/src/features/apps/connected-apps-page.test.tsx
+++ b/apps/web/src/features/apps/connected-apps-page.test.tsx
@@ -327,6 +327,47 @@ describe("Connected apps", () => {
expect(screen.queryByRole("button", { name: "Facebook" })).toBeNull();
});
+ it("shows an Outlook identity as the sign-in name", async () => {
+ const runtime = await testRuntime();
+ const catalog = await runtime.client.listExternalApps();
+ const gmailApp = catalog.apps.find((app) => app.key === "gmail")!;
+ vi.spyOn(runtime.client, "listExternalApps").mockResolvedValue({
+ ...catalog,
+ apps: [
+ ...catalog.apps,
+ { ...gmailApp, key: "outlook", display_name: "Outlook" },
+ ],
+ });
+ const existing = (await runtime.client.listExternalConnections())
+ .connections[0]!;
+ vi.spyOn(runtime.client, "listExternalConnections").mockResolvedValue({
+ connections: [
+ existing,
+ {
+ ...existing,
+ id: "outlook-1",
+ identity_label: "[email protected]",
+ provider: "outlook",
+ },
+ ],
+ });
+
+ renderPage(runtime, "/apps?app=outlook");
+ const outlook = await screen.findByRole("dialog", { name: "Outlook" });
+ expect(
+ await within(outlook).findByText("Signed in as [email protected]"),
+ ).toBeVisible();
+ });
+
+ it("shows a Gmail identity as the address itself", async () => {
+ const runtime = await testRuntime();
+
+ renderPage(runtime, "/apps?app=gmail");
+ const gmail = await screen.findByRole("dialog", { name: "Gmail" });
+ expect(await within(gmail).findByText("[email protected]")).toBeVisible();
+ expect(within(gmail).queryByText(/Signed in as/)).toBeNull();
+ });
+
it("counts active accounts and those that need reconnecting", async () => {
const runtime = await testRuntime();
const existing = (await runtime.client.listExternalConnections())
diff --git a/apps/web/src/features/apps/connection-state.test.ts b/apps/web/src/features/apps/connection-state.test.ts
index 80c877f0..cdd890d5 100644
--- a/apps/web/src/features/apps/connection-state.test.ts
+++ b/apps/web/src/features/apps/connection-state.test.ts
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
import type { TeamHubExternalConnection } from "@/features/teamhub/teamhub-types";
import {
+ accountIdentityText,
activeExternalConnections,
connectLinkOpen,
establishedExternalConnections,
@@ -79,3 +80,16 @@ describe("Connect Link reuse", () => {
).toBe(false);
});
});
+
+describe("accountIdentityText", () => {
+ it("shows an Outlook label as the sign-in name, not a mailbox", () => {
+ expect(accountIdentityText("outlook", "[email protected]")).toBe(
+ "Signed in as [email protected]",
+ );
+ expect(accountIdentityText("gmail", "[email protected]")).toBe(
+ );
+ expect(accountIdentityText("outlook", "")).toBeUndefined();
+ expect(accountIdentityText("outlook", undefined)).toBeUndefined();
+ });
+});
diff --git a/apps/web/src/features/apps/connection-state.ts b/apps/web/src/features/apps/connection-state.ts
index 041d9526..ccdbd356 100644
--- a/apps/web/src/features/apps/connection-state.ts
+++ b/apps/web/src/features/apps/connection-state.ts
@@ -99,3 +99,16 @@ export function reauthorizationConnectUrl(connection?: {
connect_expires_at: connection.reauthorization_connect_expires_at,
});
}
+
+/**
+ * A connection's identity label as display text, or undefined when it has
+ * none. An Outlook label is the Microsoft account's sign-in name, which can
+ * belong to another mail provider, so it is never shown as the mailbox.
+ */
+export function accountIdentityText(
+ provider: string,
+ label: string | null | undefined,
+): string | undefined {
+ if (!label) return undefined;
+ return provider === "outlook" ? `Signed in as ${label}` : label;
+}
diff --git a/apps/web/src/features/rooms/cards/decision-connection-auth-view.test.tsx b/apps/web/src/features/rooms/cards/decision-connection-auth-view.test.tsx
index dcca49c2..eda426bf 100644
--- a/apps/web/src/features/rooms/cards/decision-connection-auth-view.test.tsx
+++ b/apps/web/src/features/rooms/cards/decision-connection-auth-view.test.tsx
@@ -462,6 +462,39 @@ describe("Chat connection authorization", () => {
).toHaveTextContent("[email protected]");
});
+ it("shows an Outlook account as the sign-in name in the picker", async () => {
+ await setup(
+ { ...card, connection_auth: { app_key: "outlook" } },
+ "alice",
+ false,
+ "active",
+ [
+ {
+ id: "outlook-1",
+ provider: "outlook",
+ identity_label: "[email protected]",
+ },
+ {
+ id: "outlook-2",
+ provider: "outlook",
+ identity_label: "[email protected]",
+ },
+ ],
+ );
+ expect(
+ await screen.findByRole("combobox", { name: /account/ }),
+ ).toHaveTextContent("Signed in as [email protected]");
+ });
+
+ it("shows a non-Outlook account label as it is in the picker", async () => {
+ await setup(card, "alice", true, "active", [
+ { id: "notion-2", identity_label: "Second Notion" },
+ ]);
+ expect(
+ await screen.findByRole("combobox", { name: "Notion account" }),
+ ).not.toHaveTextContent("Signed in as");
+ });
+
it("offers a new account when the requested one is not connected", async () => {
await setup({
...card,
diff --git a/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx b/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx
index 30fb620e..21dd9488 100644
--- a/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-connection-auth-view.tsx
@@ -23,6 +23,7 @@ import {
reauthorizationConnectUrl,
startReauthorization,
usableConnectUrl,
+ accountIdentityText,
} from "@/features/apps/connection-state";
import { openOAuthUrl } from "@/features/apps/oauth-popup";
import { useTeamHubRuntime } from "@/features/teamhub/teamhub-runtime";
@@ -399,7 +400,7 @@ function ConnectionAuthorizationActions({
>
{available.map((connection) => (
<SelectItem key={connection.id} value={connection.id}>
- {`${connection.identity_label || appName}${
+ {`${accountIdentityText(connection.provider, connection.identity_label) || appName}${
connection.status === "active"
? ""
: connection.status === "pending"
diff --git a/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx b/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx
index f53a7bee..78eda6a9 100644
--- a/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx
+++ b/apps/web/src/features/rooms/cards/decision-profile-setup-view.tsx
@@ -23,6 +23,7 @@ import {
import {
activeExternalConnections,
openPendingExternalConnection,
+ accountIdentityText,
} from "@/features/apps/connection-state";
import { teamHubDone } from "@/features/teamhub/teamhub-api";
import {
@@ -299,7 +300,8 @@ function SetupAppRow({
className="size-1.5 shrink-0 rounded-full bg-[var(--app-status-success-text)]"
/>
<span className="truncate">
- {active.identity_label ?? "Connected"}
+ {accountIdentityText(active.provider, active.identity_label) ??
+ "Connected"}
</span>
</span>
) : verifying && showConnections ? (
diff --git a/apps/web/src/features/settings/account-disconnect-dialogs.tsx b/apps/web/src/features/settings/account-disconnect-dialogs.tsx
index 08136704..8c543f99 100644
--- a/apps/web/src/features/settings/account-disconnect-dialogs.tsx
+++ b/apps/web/src/features/settings/account-disconnect-dialogs.tsx
@@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { Button } from "@/components/ui/button";
import { ModalDialog } from "@/components/ui/modal-dialog";
+import { accountIdentityText } from "@/features/apps/connection-state";
import { externalConnectionsQueryKey } from "@/features/apps/connected-apps-queries";
import { type TeamHubClient } from "@/features/teamhub/teamhub-client";
import type { TeamHubExternalConnection } from "@/features/teamhub/teamhub-types";
@@ -33,8 +34,11 @@ export function DisconnectAccountDialog({
<ModalDialog
description={
<>
- {connection.identity_label ?? connection.provider}. Agent access and
- source cleanup stay on Apps.
+ {accountIdentityText(
+ connection.provider,
+ connection.identity_label,
+ ) ?? connection.provider}
+ . Agent access and source cleanup stay on Apps.
</>
}
onClose={onClose}
diff --git a/apps/web/src/features/settings/account-more-dialog.tsx b/apps/web/src/features/settings/account-more-dialog.tsx
index 829ebf38..869158c0 100644
--- a/apps/web/src/features/settings/account-more-dialog.tsx
+++ b/apps/web/src/features/settings/account-more-dialog.tsx
@@ -30,6 +30,7 @@ import {
connectLinkOpen,
externalConnectionNeedsAttention,
usableConnectUrl,
+ accountIdentityText,
} from "@/features/apps/connection-state";
import {
externalAppsQueryOptions,
@@ -607,7 +608,10 @@ function AccountMoreSelectionStep({
Choose {providerDisplayName(connection.provider)} content
</h3>
<p className="mt-1 text-xs text-muted-foreground">
- {connection.identity_label ?? "Connected account"}
+ {accountIdentityText(
+ connection.provider,
+ connection.identity_label,
+ ) ?? "Connected account"}
</p>
</div>
<ProviderSelectionPicker
@@ -883,7 +887,12 @@ function AppConnectRow({
<p className="truncate text-sm font-medium">{app.display_name}</p>
<p className="truncate text-xs text-muted-foreground">
{singleActive
- ? `Connected as ${singleActive.identity_label ?? "account"}`
+ ? `Connected: ${
+ accountIdentityText(
+ singleActive.provider,
+ singleActive.identity_label,
+ ) ?? "account"
+ }`
: active.length
? `${active.length} connected accounts`
: unavailable
@@ -945,7 +954,11 @@ function AppConnectRow({
{active.length > 1 ? (
<div className="mt-1 ml-12 divide-y divide-border">
{active.map((connection) => {
- const identity = connection.identity_label ?? "Connected account";
+ const identity =
+ accountIdentityText(
+ connection.provider,
+ connection.identity_label,
+ ) ?? "Connected account";
return (
<div className="py-1.5" key={connection.id}>
<div className="flex min-h-10 items-center justify-between gap-3">
@@ -977,7 +990,12 @@ function AppConnectRow({
key={connection.id}
>
<span className="min-w-0 truncate text-xs text-muted-foreground">
- {`${connection.identity_label ?? "Account"} needs attention in Apps`}
+ {`Needs attention in Apps: ${
+ accountIdentityText(
+ connection.provider,
+ connection.identity_label,
+ ) ?? "account"
+ }`}
</span>
<Link
className="text-xs font-medium text-app-link hover:underline"
diff --git a/apps/web/src/features/wiki/wiki-profile-sources.test.tsx b/apps/web/src/features/wiki/wiki-profile-sources.test.tsx
index d11b16f2..f49a2d18 100644
--- a/apps/web/src/features/wiki/wiki-profile-sources.test.tsx
+++ b/apps/web/src/features/wiki/wiki-profile-sources.test.tsx
@@ -45,6 +45,40 @@ beforeEach(() => {
});
describe("Wiki Profile sources", () => {
+ it("shows a single Outlook account as its sign-in name", async () => {
+ const runtime = await testRuntime();
+ const gmail = (await runtime.client.listExternalConnections())
+ .connections[0]!;
+ const catalog = await runtime.client.listExternalApps();
+ const gmailApp = catalog.apps.find((app) => app.key === "gmail")!;
+ vi.spyOn(runtime.client, "listExternalApps").mockResolvedValue({
+ ...catalog,
+ apps: [{ ...gmailApp, display_name: "Outlook Mail", key: "outlook" }],
+ });
+ vi.spyOn(runtime.client, "listExternalConnections").mockResolvedValue({
+ connections: [
+ {
+ ...gmail,
+ id: "external-connection-outlook",
+ provider: "outlook",
+ identity_label: "[email protected]",
+ },
+ ],
+ });
+ renderProfile(runtime);
+
+ await openAddSource();
+ const dialog = await screen.findByRole("dialog", {
+ name: "Add profile sources",
+ });
+ const addOutlook = await within(dialog).findByRole("button", {
+ name: "Add Outlook Mail",
+ });
+ expect(addOutlook.parentElement).toHaveTextContent(
+ "Connected: Signed in as [email protected]",
+ );
+ });
+
it("adds an already connected Gmail account to the profile", async () => {
const runtime = await testRuntime();
const generate = vi
@@ -70,7 +104,7 @@ describe("Wiki Profile sources", () => {
name: "Add Gmail",
});
expect(addGmail.parentElement).toHaveTextContent(
- "GmailConnected as [email protected]",
+ "GmailConnected: [email protected]",
);
fireEvent.click(addGmail);
await waitFor(() => expect(generate).toHaveBeenCalledOnce());
diff --git a/apps/web/src/features/wiki/wiki-profile-sources.tsx b/apps/web/src/features/wiki/wiki-profile-sources.tsx
index dc6db672..324b2b30 100644
--- a/apps/web/src/features/wiki/wiki-profile-sources.tsx
+++ b/apps/web/src/features/wiki/wiki-profile-sources.tsx
@@ -8,6 +8,7 @@ import { AppLogo } from "@/features/apps/app-logo";
import {
activeExternalConnections,
externalConnectionNeedsAttention,
+ accountIdentityText,
} from "@/features/apps/connection-state";
import {
externalAppsQueryOptions,
@@ -83,7 +84,7 @@ export function WikiProfileSourcesRow({
app: app.display_name,
connection,
id: connection.id,
- label: `${app.display_name} · ${connection.identity_label ?? "Connected account"} — connected`,
+ label: `${app.display_name} · ${accountIdentityText(app.key, connection.identity_label) ?? "Connected account"} — connected`,
logoUrl: app.logo_url,
provider: app.key,
state: "connected",