From 05ba57651f61b5a184fd75ac5e18bdc78d50e05b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Mar 2026 23:06:00 +0000 Subject: [PATCH] Fall back to displayName when username is null for Discord webhook Users who sign up via OAuth (Google, GitHub, etc.) without setting a Clerk username have a null `username` field but always have a `displayName` (computed from firstName+lastName or email). Previously, `usernameByClerkId` was filtered to only include users with a non-null username, causing those owners to appear without any identifier in Discord standings messages (e.g. "Liverpool def. Galatasaray" instead of "Liverpool def. Galatasaray (Madmike)"). https://claude.ai/code/session_01VAkeDDVZMYS1DweQnUrRnH --- app/models/scoring-calculator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/scoring-calculator.ts b/app/models/scoring-calculator.ts index f09e1af..380bbcc 100644 --- a/app/models/scoring-calculator.ts +++ b/app/models/scoring-calculator.ts @@ -1313,8 +1313,8 @@ export async function recalculateAffectedLeagues( : []; const usernameByClerkId = new Map( teamOwnerUsers - .filter((u) => u.username != null) - .map((u) => [u.clerkId, u.username!]) + .map((u) => [u.clerkId, u.username ?? u.displayName]) + .filter((entry): entry is [string, string] => entry[1] != null) ); // Build teamId → ownerId map from standings data