Skip to content

Commit

Permalink
Add missing vote permission check. Fixes #28
Browse files Browse the repository at this point in the history
Also fix error messages not appearing on screen
  • Loading branch information
clarkwinkelmann committed Dec 1, 2020
1 parent f3c5dda commit 02cb46b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/dist/forum.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dist/forum.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src/forum/components/DiscussionPoll.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default class DiscussionPoll extends Component {
onError(evt, error) {
evt.target.checked = false;

app.alerts.show(error.alert);
throw error;
}

changeVote(option, evt) {
Expand Down
2 changes: 2 additions & 0 deletions src/Commands/VotePollHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public function handle(VotePoll $command)

$optionId = Arr::get($data, 'optionId');

$actor->assertCan('votePolls');

if ($poll->hasEnded()) {
throw new PermissionDeniedException();
}
Expand Down

0 comments on commit 02cb46b

Please sign in to comment.