mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-30 15:17:43 -05:00
Mark tournament team chats as inactive once the tournament is finalized
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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),
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
navItem: medal
|
||||
type: bug
|
||||
---
|
||||
Fix tournament team chats staying active after the tournament was finalized
|
||||
Reference in New Issue
Block a user