diff --git a/app/features/chat/ChatSystemMessage.server.ts b/app/features/chat/ChatSystemMessage.server.ts index 18cd53bf1..69da91c06 100644 --- a/app/features/chat/ChatSystemMessage.server.ts +++ b/app/features/chat/ChatSystemMessage.server.ts @@ -141,6 +141,10 @@ export async function setMetadata(args: SetMetadataArgs) { args.participantUserIds, ); + logger.debug( + `Setting chat room metadata for ${args.chatCode} (participants: ${participantsKey})`, + ); + return void fetch(process.env.SKALOP_SYSTEM_MESSAGE_URL, { method: "POST", body: JSON.stringify({ diff --git a/app/features/tournament-bracket/loaders/to.$id.matches.$mid.server.ts b/app/features/tournament-bracket/loaders/to.$id.matches.$mid.server.ts index 06f8aed54..8ace38f65 100644 --- a/app/features/tournament-bracket/loaders/to.$id.matches.$mid.server.ts +++ b/app/features/tournament-bracket/loaders/to.$id.matches.$mid.server.ts @@ -6,6 +6,7 @@ import { chatAccessible } from "~/features/chat/chat-utils"; import * as TournamentRepository from "~/features/tournament/TournamentRepository.server"; import * as TournamentTeamRepository from "~/features/tournament/TournamentTeamRepository.server"; import * as UserRepository from "~/features/user-page/UserRepository.server"; +import { Status } from "~/modules/brackets-model"; import { cache, IN_MILLISECONDS, ttl } from "~/utils/cache.server"; import { IS_E2E_TEST_RUN } from "~/utils/e2e"; import { logger } from "~/utils/logger"; @@ -148,7 +149,8 @@ export const loader = async ({ params }: LoaderFunctionArgs) => { match.chatCode && !matchIsOver && match.opponentOne?.id && - match.opponentTwo?.id + match.opponentTwo?.id && + match.status > Status.Locked ) { // only add global chat for active roster (or all if not yet set i.e. first match) // if roster changed mid-set the subs can still see the chat on the match page @@ -180,7 +182,7 @@ export const loader = async ({ params }: LoaderFunctionArgs) => { }); } - const shouldSeeChat = + const hasPermsToSeeChat = tournament.isOrganizerOrStreamer(user) || match.players.some((p) => p.id === user?.id); @@ -195,10 +197,10 @@ export const loader = async ({ params }: LoaderFunctionArgs) => { }); const visibleChatCode = - shouldSeeChat && !chatCodeExpired ? match.chatCode : undefined; + hasPermsToSeeChat && !chatCodeExpired ? match.chatCode : undefined; return { - match: shouldSeeChat ? match : { ...match, chatCode: undefined }, + match: hasPermsToSeeChat ? match : { ...match, chatCode: undefined }, results, mapList, matchIsOver,