Skip to content

Commit 08a0f9f

Browse files
authored
AP bots may boost (#1955)
1 parent f821e4f commit 08a0f9f

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

src/Service/VoteManager.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ public function vote(int $choice, VotableInterface $votable, User $user, $rateLi
4040
}
4141
}
4242

43-
if ('Service' === $user->type) {
44-
throw new AccessDeniedHttpException('Bots are not allowed to vote on items!');
45-
}
46-
4743
$downVotesMode = $this->settingsManager->getDownvotesMode();
4844
if (DownvotesMode::Disabled === $downVotesMode && VotableInterface::VOTE_DOWN === $choice) {
4945
throw new \LogicException('cannot downvote, because that is disabled');
5046
}
47+
if (VotableInterface::VOTE_DOWN === $choice && 'Service' === $user->type) {
48+
throw new AccessDeniedHttpException('Bots are not allowed to vote on items!');
49+
}
5150

5251
$vote = $votable->getUserVote($user);
5352
$votedAgain = false;
@@ -122,10 +121,6 @@ private function guessUserChoice(int $choice, int $vote): int
122121

123122
public function upvote(VotableInterface $votable, User $user): Vote
124123
{
125-
if ('Service' === $user->type) {
126-
throw new AccessDeniedHttpException('Bots are not allowed to vote on items!');
127-
}
128-
129124
// @todo save activity pub object id
130125
$vote = $votable->getUserVote($user);
131126

@@ -162,10 +157,6 @@ public function upvote(VotableInterface $votable, User $user): Vote
162157

163158
public function removeVote(VotableInterface $votable, User $user): ?Vote
164159
{
165-
if ('Service' === $user->type) {
166-
throw new AccessDeniedHttpException('Bots are not allowed to vote on items!');
167-
}
168-
169160
// @todo save activity pub object id
170161
$vote = $votable->getUserVote($user);
171162

0 commit comments

Comments
 (0)