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
This commit is contained in:
parent
143698cb96
commit
05ba57651f
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue