Skip to content

Commit

Permalink
fix: cannot vote when do not have the permission to change votes (#102)
Browse files Browse the repository at this point in the history
* fix: cannot vote when do not have the permission to change votes

* fix mistake in the comment
  • Loading branch information
MessyGhost authored Dec 9, 2024
1 parent 9d30e39 commit de5680c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Commands/MultipleVotesPollHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ protected function isChangingVotes(array $optionIds, array $myVotes): bool
// Check the arrays have the same values
$same = (count(array_diff($optionIds, $myVotes)) === 0 && count(array_diff($myVotes, $optionIds)) === 0);

return !$same;
// Only when we have already voted that we are changing votes
return count($myVotes) !== 0 && !$same;
}

protected function validateInput(?array $optionIds, int $maxVotes, Collection $options): void
Expand Down

0 comments on commit de5680c

Please sign in to comment.