Skip to content

Commit bd1fa71

Browse files
authored
Merge pull request #751 from pupi1985/patch-130
Prevent duplicated vote events
2 parents 3bed58a + 6e7176d commit bd1fa71

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

qa-include/app/votes.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ function qa_vote_set($post, $userid, $handle, $cookieid, $vote)
126126
$vote = (int)min(1, max(-1, $vote));
127127
$oldvote = (int)qa_db_uservote_get($post['postid'], $userid);
128128

129+
if ($oldvote === $vote) {
130+
return;
131+
}
132+
129133
qa_db_uservote_set($post['postid'], $userid, $vote);
130134
qa_db_post_recount_votes($post['postid']);
131135

0 commit comments

Comments
 (0)