From f36a304ddd9a4705adbd8e21c801e53cd3811635 Mon Sep 17 00:00:00 2001 From: Kjell Kind Date: Mon, 26 Oct 2026 22:49:59 +0100 Subject: [PATCH] fix: read the contributor handle from their profile on the about page The about page linked contributors by their username, which moved to the profile as their handle just before it was merged, so it crashed for anyone on /dev/null among the contributors. Co-Authored-By: Claude Opus 5.5 --- app/Queries/ContributorsQuery.php | 12 ++++++------ resources/js/lib/about.ts | 4 ++-- resources/js/pages/about/show.tsx | 8 ++++---- tests/Feature/Controllers/AboutControllerTest.php | 8 ++++---- tests/Unit/Queries/ContributorsQueryTest.php | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/Queries/ContributorsQuery.php b/app/Queries/ContributorsQuery.php index fce4c9959..5bbaba6d4 100644 --- a/app/Queries/ContributorsQuery.php +++ b/app/Queries/ContributorsQuery.php @@ -12,7 +12,7 @@ /** * @phpstan-type Account array{login: string, github_id: string, commits: int} - * @phpstan-type Contributor array{login: string, commits: int, username: string|null} + * @phpstan-type Contributor array{login: string, commits: int, handle: string|null} */ final readonly class ContributorsQuery { @@ -35,8 +35,8 @@ public function __construct(private GitHub $github) } /** - * The repository contributors, most commits first, as GitHub counts them, each with their /dev/null username, or - * null when they aren't on it. They are found by their GitHub account, since a username can change on either side. + * The repository contributors, most commits first, as GitHub counts them, each with their /dev/null handle, or + * null when they aren't on it. They are found by their GitHub account, since a handle can change on either side. * * @return list|null */ @@ -48,15 +48,15 @@ public function get(): ?array return null; } - $usernames = User::query() + $handles = User::query() ->whereIn('github_id', array_column($accounts, 'github_id')) ->get() - ->mapWithKeys(fn (User $user): array => [$user->github_id => $user->username]); + ->mapWithKeys(fn (User $user): array => [$user->github_id => $user->handle]); return array_map(fn (array $account): array => [ 'login' => $account['login'], 'commits' => $account['commits'], - 'username' => $usernames->get($account['github_id']), + 'handle' => $handles->get($account['github_id']), ], $accounts); } diff --git a/resources/js/lib/about.ts b/resources/js/lib/about.ts index 903985d2e..c3255fefc 100644 --- a/resources/js/lib/about.ts +++ b/resources/js/lib/about.ts @@ -36,12 +36,12 @@ export type StoryPerson = { }; /** - * Someone with a commit on production. The username is theirs on /dev/null, or null when they aren't on it. + * Someone with a commit on production. The handle is theirs on /dev/null, or null when they aren't on it. */ export type StoryContributor = { login: string; commits: number; - username: string | null; + handle: string | null; }; export const storyBefore: StoryEvent[] = [ diff --git a/resources/js/pages/about/show.tsx b/resources/js/pages/about/show.tsx index be1b5f2dc..6982275e6 100644 --- a/resources/js/pages/about/show.tsx +++ b/resources/js/pages/about/show.tsx @@ -302,7 +302,7 @@ function Contributors({ contributors }: { contributors: StoryContributor[] }) {