From b92acf0e5a5772f5f73f9f42816e5a893949e7c7 Mon Sep 17 00:00:00 2001 From: Cihad OGE Date: Sat, 13 Jul 2013 15:58:30 -0700 Subject: [PATCH] Fixed voting comments bug on Ponder Summary: When user changed his mind for voting, counting does not work properly. If user vote up first and vote down, vote count must be decreased 2. fixed in javascript file Test Plan: http://cihad.phabricator.pompa.la/Q11 user : demo pass : demodemo Reviewers: aran, Korvin, epriestley Reviewed By: epriestley CC: simsekburak Differential Revision: https://secure.phabricator.com/D6446 --- src/__celerity_resource_map__.php | 2 +- webroot/rsrc/js/application/ponder/behavior-votebox.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 8899a965fe..3a0682422b 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -2282,7 +2282,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-ponder-votebox' => array( - 'uri' => '/res/d8c973a2/rsrc/js/application/ponder/behavior-votebox.js', + 'uri' => '/res/c28daa12/rsrc/js/application/ponder/behavior-votebox.js', 'type' => 'js', 'requires' => array( diff --git a/webroot/rsrc/js/application/ponder/behavior-votebox.js b/webroot/rsrc/js/application/ponder/behavior-votebox.js index f72d17a1bf..9bdcd28e52 100644 --- a/webroot/rsrc/js/application/ponder/behavior-votebox.js +++ b/webroot/rsrc/js/application/ponder/behavior-votebox.js @@ -16,6 +16,8 @@ JX.behavior('ponder-votebox', function(config) { var data = e.getNodeData('ponder-votable'); if (data.vote != vote) { + // Remove the user's current vote, if they have one. + data.count -= data.vote; data.vote = vote; data.count += vote; } else {