From 6e7176d20abfb322ef5976c03dd7dd6c22529793 Mon Sep 17 00:00:00 2001 From: pupi1985 Date: Thu, 2 May 2019 20:14:09 -0300 Subject: [PATCH] Prevent duplicated vote events --- qa-include/app/votes.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qa-include/app/votes.php b/qa-include/app/votes.php index 420a3ffad..14f41c385 100644 --- a/qa-include/app/votes.php +++ b/qa-include/app/votes.php @@ -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']);