Mark tournament team chats as inactive once the tournament is finalized
Some checks failed
E2E Tests / e2e (push) Has been cancelled
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled

This commit is contained in:
Kalle
2026-09-28 21:05:44 +03:00
parent 525d69f1b7
commit 5c47ce3cc6
4 changed files with 28 additions and 0 deletions

View File

@@ -196,6 +196,26 @@ describe("ChatRoomResolver.resolve", () => {
expect(room.permissions.OBSERVE).toContain(authorId);
});
test("marks a TOURNAMENT_TEAM room inactive once the tournament is finalized", async () => {
const tournament = await TournamentFactory.create({
authorId: users.id(2),
});
const team = await TournamentTeamFactory.create(
{
tournamentId: tournament.id,
memberUserIds: [users.id(3), users.id(4)],
},
{ isLooking: true },
);
const chatRoomId = await teamChatRoomId(team.id);
expect((await resolveOrThrow(chatRoomId)).inactive).toBe(false);
await TournamentRepository.finalizeWithoutSummary(tournament.id);
expect((await resolveOrThrow(chatRoomId)).inactive).toBe(true);
});
test("resolves a SCRIM room to the post's users plus the accepted request's users", async () => {
const { chatRoomId, postUserIds, requestUserIds, startsAt } =
await setupAcceptedScrim();

View File

@@ -224,6 +224,7 @@ async function resolveTournamentTeamRooms(
participantUserIds: owner.members.map((member) => member.userId),
observerUserIds: organizers.get(owner.tournamentId)?.ORGANIZE ?? [],
labelByUserId: organizerLabels(organizers.get(owner.tournamentId)),
inactive: Boolean(owner.isFinalized),
}));
}

View File

@@ -23,6 +23,7 @@ export async function findAllByChatRoomIds(chatRoomIds: number[]) {
return db
.selectFrom("TournamentTeam")
.innerJoin("Tournament", "Tournament.id", "TournamentTeam.tournamentId")
.innerJoin(
"CalendarEvent",
"CalendarEvent.tournamentId",
@@ -32,6 +33,7 @@ export async function findAllByChatRoomIds(chatRoomIds: number[]) {
"TournamentTeam.chatRoomId",
"TournamentTeam.name",
"TournamentTeam.tournamentId",
"Tournament.isFinalized",
"CalendarEvent.name as tournamentName",
tournamentLogoWithDefault(eb).as("logoUrl"),
jsonArrayFrom(

View File

@@ -0,0 +1,5 @@
---
navItem: medal
type: bug
---
Fix tournament team chats staying active after the tournament was finalized