From d554ae389c4cae752baa09ee38ce78bf4f25acf3 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:11:21 +0300 Subject: [PATCH] Make tournament organization member names show in the chat --- app/features/tournament-bracket/components/StartedMatch.tsx | 6 +++++- app/features/tournament/TournamentRepository.server.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/features/tournament-bracket/components/StartedMatch.tsx b/app/features/tournament-bracket/components/StartedMatch.tsx index c01f747c09..7eae1d4710 100644 --- a/app/features/tournament-bracket/components/StartedMatch.tsx +++ b/app/features/tournament-bracket/components/StartedMatch.tsx @@ -556,6 +556,10 @@ function StartedMatchTabs({ return Object.fromEntries( [ ...data.match.players.map((p) => ({ ...p, title: undefined })), + ...(tournament.ctx.organization?.members ?? []).map((m) => ({ + ...m, + title: m.role === "STREAMER" ? "Stream" : "TO", + })), ...tournament.ctx.staff.map((s) => ({ ...s, title: s.role === "STREAMER" ? "Stream" : "TO", @@ -663,7 +667,7 @@ function StartedMatchTabs({ chat={chat} onMount={onChatMount} onUnmount={onChatUnmount} - missingUserName="TO" + missingUserName="???" /> ) : null} diff --git a/app/features/tournament/TournamentRepository.server.ts b/app/features/tournament/TournamentRepository.server.ts index 75af46230e..d3f928f0e8 100644 --- a/app/features/tournament/TournamentRepository.server.ts +++ b/app/features/tournament/TournamentRepository.server.ts @@ -58,7 +58,8 @@ export async function findById(id: number) { .select([ "TournamentOrganizationMember.userId", "TournamentOrganizationMember.role", - "User.username", + ...COMMON_USER_FIELDS, + userChatNameColor, ]) .whereRef( "TournamentOrganizationMember.organizationId",