Skip to content

Commit

Permalink
Merge pull request #751 from pupi1985/patch-130
Browse files Browse the repository at this point in the history
Prevent duplicated vote events
  • Loading branch information
svivian authored May 6, 2020
2 parents 3bed58a + 6e7176d commit bd1fa71
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions qa-include/app/votes.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
$vote = (int)min(1, max(-1, $vote));
$oldvote = (int)qa_db_uservote_get($post['postid'], $userid);

if ($oldvote === $vote) {
return;
}

qa_db_uservote_set($post['postid'], $userid, $vote);
qa_db_post_recount_votes($post['postid']);

Expand Down

0 comments on commit bd1fa71

Please sign in to comment.