Rename the Keto User namespace to Identity, matching Kratos
CI / full-gate (push) Successful in 2m34s

This commit is contained in:
2026-08-03 12:19:12 +02:00
parent ca3d49ec45
commit f7d70cfff8
37 changed files with 220 additions and 212 deletions
+7 -7
View File
@@ -5,7 +5,7 @@
// the profile shows the email's local part as the name with the full email beneath, initials from
// the local part; anonymous ⇒ "Guest".
import type { User } from "../http/context.ts";
import type { SessionIdentity } from "../http/context.ts";
import { type MenuConfig } from "./menu-config.ts";
export interface ShellUser {
@@ -24,10 +24,10 @@ export interface ShellModel {
user: ShellUser;
}
export function shellUser(user: User | null | undefined): ShellUser {
if (!user) return { email: "", initials: "G", name: "Guest" };
const local = user.email.split("@")[0] || user.email;
return { email: user.email, initials: (local.slice(0, 2) || "U").toUpperCase(), name: local };
export function shellUser(identity: SessionIdentity | null | undefined): ShellUser {
if (!identity) return { email: "", initials: "G", name: "Guest" };
const local = identity.email.split("@")[0] || identity.email;
return { email: identity.email, initials: (local.slice(0, 2) || "U").toUpperCase(), name: local };
}
export function buildShellContext(opts: {
@@ -36,7 +36,7 @@ export function buildShellContext(opts: {
menu: MenuConfig;
signInHref?: string;
title: string;
user?: User | null;
identity?: SessionIdentity | null;
}): ShellModel {
const b = opts.menu.branding;
return {
@@ -46,6 +46,6 @@ export function buildShellContext(opts: {
...(opts.signInHref != null ? { signInHref: opts.signInHref } : {}),
...(b.theme != null ? { theme: b.theme } : {}),
title: opts.title,
user: shellUser(opts.user),
user: shellUser(opts.identity),
};
}