diff --git a/app/Http/Controllers/ContestEntriesController.php b/app/Http/Controllers/ContestEntriesController.php index f74bf90aa38..462cc473a83 100644 --- a/app/Http/Controllers/ContestEntriesController.php +++ b/app/Http/Controllers/ContestEntriesController.php @@ -62,10 +62,6 @@ public function judgeVote($id) ->with('judgeVotes') ->findOrFail($id); - if (!$entry->contest->isJudgingActive()) { - throw new InvariantException(osu_trans('contest.judge.validation.judging_not_active')); - } - priv_check('ContestJudge', $entry->contest)->ensureCan(); $params = get_params(request()->all(), null, [ diff --git a/app/Http/Controllers/ContestsController.php b/app/Http/Controllers/ContestsController.php index 427b7ee4f7e..2466c416607 100644 --- a/app/Http/Controllers/ContestsController.php +++ b/app/Http/Controllers/ContestsController.php @@ -32,7 +32,7 @@ public function judge($id) ->with('judgeCategories') ->findOrFail($id); - abort_if(!$contest->isJudgingActive(), 404); + abort_if(!$contest->isJudged(), 404); priv_check('ContestJudge', $contest)->ensureCan(); diff --git a/app/Libraries/OsuAuthorize.php b/app/Libraries/OsuAuthorize.php index eb2030c94f5..21e0a9143c3 100644 --- a/app/Libraries/OsuAuthorize.php +++ b/app/Libraries/OsuAuthorize.php @@ -1340,6 +1340,10 @@ public function checkContestJudge(?User $user, Contest $contest): string { $this->ensureLoggedIn($user); + if (!$contest->isJudgingActive()) { + return 'contest.judging_not_active'; + } + if ($contest->judges->find($user->getKey()) === null) { return 'unauthorized'; } diff --git a/resources/lang/en/authorization.php b/resources/lang/en/authorization.php index a48be061aac..1db30df9de9 100644 --- a/resources/lang/en/authorization.php +++ b/resources/lang/en/authorization.php @@ -81,6 +81,7 @@ ], 'contest' => [ + 'judging_not_active' => 'Judging for this contest isn\'t active.', 'voting_over' => 'You cannot change your vote after the voting period for this contest has ended.', 'entry' => [ diff --git a/resources/lang/en/contest.php b/resources/lang/en/contest.php index 9658262d2a5..cdf974aa862 100644 --- a/resources/lang/en/contest.php +++ b/resources/lang/en/contest.php @@ -20,7 +20,6 @@ 'update' => 'update', 'validation' => [ 'contest_vote_judged' => 'can\'t vote in judged contests', - 'judging_not_active' => 'judging for this contest isn\'t active', 'missing_category_vote' => 'missing category vote', ], ], diff --git a/resources/views/contests/voting.blade.php b/resources/views/contests/voting.blade.php index 2cfe49389c6..badef22af8c 100644 --- a/resources/views/contests/voting.blade.php +++ b/resources/views/contests/voting.blade.php @@ -39,7 +39,7 @@ {{ $noVoteReason }} - @if ($contestMeta->isJudgingActive() && priv_check('ContestJudge', $contestMeta)->can()) + @if ($contestMeta->isJudged() && priv_check('ContestJudge', $contestMeta)->can())
{{osu_trans('contest.voting.judge_link')}}