FIX: don't send xhr request when vote limit is reached (#57)

When the user used all the votes we should not send a request to create a vote. We should only display information about votes.

The bug was mentioned on meta: https://meta.discourse.org/t/the-vote-button-should-be-disabled-when-the-limit-is-reached/68902
This commit is contained in:
Krzysztof Kotlarek 2020-09-30 15:42:34 +10:00 committed by GitHub
parent fdedc0e159
commit 1d501226fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -77,7 +77,8 @@ export default createWidget("vote-button", {
if (
!this.attrs.closed &&
this.parentWidget.state.allowClick &&
!this.attrs.user_voted
!this.attrs.user_voted &&
!this.currentUser.votes_exceeded
) {
this.parentWidget.state.allowClick = false;
this.parentWidget.state.initialVote = true;