Skip to content

Commit c771228

Browse files
authored
emergency hide match results (#919)
:shipit:
1 parent a3c0a09 commit c771228

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

backend/siarnaq/api/compete/serializers.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,20 @@ def to_representation(self, instance):
271271
if self.context["user_is_staff"]:
272272
# Staff can see everything
273273
pass
274+
elif (
275+
(
276+
instance.tournament_round is not None
277+
and instance.tournament_round.release_status <= ReleaseStatus.HIDDEN
278+
)
279+
or (
280+
instance.tournament_round is not None
281+
and not instance.tournament_round.tournament.is_public
282+
)
283+
or instance.participants.filter(team__status=TeamStatus.INVISIBLE).exists()
284+
):
285+
# Fully redact matches from private tournaments, unreleased tournament
286+
# rounds, and those with invisible teams.
287+
data["participants"] = data["replay_url"] = data["maps"] = None
274288
elif (
275289
instance.tournament_round is not None
276290
and instance.tournament_round.release_status <= ReleaseStatus.PARTICIPANTS

0 commit comments

Comments
 (0)