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.
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 1 | import type { Route } from "./+types/emails"; |
| 2 | import { page } from "../../lib/meta"; | |
| 3 | import { assertSameOrigin, requireUser } from "../../lib/session.server"; | |
| 4 | import { EmailsSection } from "../../components/emails-section"; | |
| 5 | import { EMAIL_INTENTS, emailAction, loadEmails } from "../../lib/emails.server"; | |
| 6 | import { githubSignIn } from "../../lib/github.server"; | |
| 7 | ||
| 8 | export function meta(args: Route.MetaArgs) { | |
| 9 | return page(args, { title: "Emails · Settings · g1t" }); | |
| 10 | } | |
| 11 | ||
| 12 | export async function loader({ request, context }: Route.LoaderArgs) { | |
| 13 | const user = requireUser(context, request); | |
| 14 | const [emails, github] = await Promise.all([loadEmails(user), githubSignIn.account(user).catch(() => null)]); | |
| 15 | // Whether a sensitive change can be confirmed with a password. | |
| 16 | return { emails: emails.emails, hasPassword: github?.hasPassword ?? true }; | |
| 17 | } | |
| 18 | ||
| 19 | export async function action({ request, context }: Route.ActionArgs) { | |
| 20 | assertSameOrigin(request); | |
| 21 | const user = requireUser(context, request); | |
| 22 | const form = await request.formData(); | |
| 23 | // Sensitive changes may first ask for the password (lib/emails.server.ts). | |
| 24 | if ((EMAIL_INTENTS as readonly string[]).includes(String(form.get("intent")))) { | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 25 | // Which form posted, so its answer shows beside it. |
| 26 | return { emailAction: await emailAction(user, form, request), emailIntent: String(form.get("intent")) }; | |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 27 | } |
| 28 | return null; | |
| 29 | } | |
| 30 | ||
| 31 | export default function EmailSettings({ loaderData, actionData }: Route.ComponentProps) { | |
| 32 | return ( | |
| 33 | <EmailsSection | |
| 34 | data={loaderData.emails} | |
| 35 | actionData={actionData?.emailAction} | |
| Merge branch 'worktree-agent-a985c01f43538af01' | 36 | intent={actionData?.emailIntent} |
| status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas | 37 | hasPassword={loaderData.hasPassword} |
| 38 | /> | |
| 39 | ); | |
| 40 | } |
This file's history is long; its oldest lines are credited to the oldest commit read.