Fix check of request limit if limit is set to 0 (unlimited)

Fixes #722
This commit is contained in:
Simon
2025-10-02 11:18:58 +02:00
committed by GitHub
@@ -102,7 +102,7 @@ class GameRequestService(
listOf(GameRequestStatus.PENDING) listOf(GameRequestStatus.PENDING)
) )
val maxRequestsPerUser = config.get(ConfigProperties.Requests.Games.MaxOpenRequestsPerUser) ?: 0 val maxRequestsPerUser = config.get(ConfigProperties.Requests.Games.MaxOpenRequestsPerUser) ?: 0
if (maxRequestsPerUser == 0 || (auth?.isAdmin() != true && pendingRequestsForUser.size >= maxRequestsPerUser)) { if (maxRequestsPerUser != 0 && auth?.isAdmin() != true && pendingRequestsForUser.size >= maxRequestsPerUser) {
throw EndpointException("You have reached the maximum number of pending requests (${maxRequestsPerUser})") throw EndpointException("You have reached the maximum number of pending requests (${maxRequestsPerUser})")
} }