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

This commit is contained in:
grimsi
2025-10-02 10:33:01 +02:00
parent 02b8039360
commit d6eb3137d3
@@ -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})")
} }