From d96a38a996f0b4af7196d22b21aa16e98a2e1e63 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 25 Apr 2024 20:23:51 +0100 Subject: [PATCH] don't save banned or inactive accounts --- .../cc/fascinated/backend/service/ScoreSaberService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/cc/fascinated/backend/service/ScoreSaberService.java b/src/main/java/cc/fascinated/backend/service/ScoreSaberService.java index 5353682..fbb6348 100644 --- a/src/main/java/cc/fascinated/backend/service/ScoreSaberService.java +++ b/src/main/java/cc/fascinated/backend/service/ScoreSaberService.java @@ -4,6 +4,7 @@ import cc.fascinated.backend.Main; import cc.fascinated.backend.common.DateUtils; import cc.fascinated.backend.common.Timer; import cc.fascinated.backend.common.WebRequest; +import cc.fascinated.backend.exception.impl.BadRequestException; import cc.fascinated.backend.exception.impl.RateLimitException; import cc.fascinated.backend.exception.impl.ResourceNotFoundException; import cc.fascinated.backend.model.account.Account; @@ -79,6 +80,12 @@ public class ScoreSaberService extends TextWebSocketHandler { log.info("Account with id '{}' not found.", id); throw new ResourceNotFoundException("Account with id '%s' not found.".formatted(id)); } + if (account.isBanned()) { + throw new BadRequestException("Account with id '%s' is banned.".formatted(id)); + } + if (account.isInactive()) { + throw new BadRequestException("Account with id '%s' is inactive.".formatted(id)); + } return account; }