Fix tournament chats expiring too early
Some checks are pending
E2E Tests / e2e (push) Waiting to run
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

In round robin, all matches are set to have both participants at the start.
If the bracket is larger e.g. 5 rounds then later rounds might have chat
disappearing before teams get a chance to play it.

Closes #3005
This commit is contained in:
Kalle
2026-04-25 21:15:17 +03:00
parent 8369771e75
commit ed0467f98e
2 changed files with 10 additions and 4 deletions

View File

@@ -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({

View File

@@ -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,