Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge the workspace shell: navigation and phone shell, g1t as orchestrator, agents in roles with audience-checked reads, reactions and custom emoji, live notifications and browser push, the homepage tour (agents 0002, chat 0002) | 1 | import { data } from "react-router"; |
| 2 | ||
| 3 | import type { Route } from "./+types/person"; | |
| 4 | import { buildCard } from "../../../lib/hovercard"; | |
| 5 | import { identity, repos } from "../../../lib/services.server"; | |
| 6 | import { requireUser, roleIn } from "../../../lib/session.server"; | |
| 7 | ||
| 8 | /** | |
| 9 | * A person's card in Chat (components/chat/profile-card.tsx): their public | |
| 10 | * profile as the hovercard has it, and the teams they are on in this | |
| 11 | * workspace that the viewer can see. Kept a minute by the browser. | |
| 12 | */ | |
| 13 | export async function loader({ params, context, request }: Route.LoaderArgs) { | |
| 14 | const viewer = requireUser(context, request); | |
| 15 | if (!roleIn(viewer, params.owner)) throw data(null, { status: 404 }); | |
| 16 | const [card, teams] = await Promise.all([ | |
| 17 | buildCard( | |
| 18 | params.username, | |
| 19 | viewer, | |
| 20 | null, | |
| 21 | { | |
| 22 | profile: (username) => identity.profile(username), | |
| 23 | accountId: async (username) => (await identity.userByUsername(username))?.id ?? null, | |
| 24 | publicNamespaces: (id) => repos.publicNamespaces(id), | |
| 25 | profileWorkspaces: (username, who, publicIn) => identity.profileWorkspaces(username, who, publicIn), | |
| 26 | contributors: (path, who) => repos.contributors(path, who), | |
| 27 | }, | |
| 28 | Date.now(), | |
| 29 | ).catch(() => null), | |
| 30 | identity.userTeams(viewer, params.owner, params.username).catch(() => null), | |
| 31 | ]); | |
| 32 | const headers = { "cache-control": "private, max-age=60", vary: "Cookie" }; | |
| 33 | if (!card || card.kind !== "user") return Response.json({ error: "not_found" }, { status: 404, headers }); | |
| 34 | return Response.json({ ...card, teams: teams?.ok ? teams.value.map((team) => ({ slug: team.slug, name: team.name })) : [] }, { headers }); | |
| 35 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.