mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
added comments to explain the voting logic
This commit is contained in:
@@ -183,11 +183,11 @@ var async = require('async'),
|
||||
hook,
|
||||
current = voteStatus.upvoted ? 'upvote' : 'downvote';
|
||||
|
||||
if (voteStatus.upvoted && command === 'downvote' || voteStatus.downvoted && command === 'upvote') {
|
||||
if (voteStatus.upvoted && command === 'downvote' || voteStatus.downvoted && command === 'upvote') { // e.g. User *has* upvoted, and clicks downvote
|
||||
hook = command;
|
||||
} else if (voteStatus.upvoted || voteStatus.downvoted) {
|
||||
} else if (voteStatus.upvoted || voteStatus.downvoted) { // e.g. User *has* upvotes, clicks upvote (so we "unvote")
|
||||
hook = 'unvote';
|
||||
} else {
|
||||
} else { // e.g. User *has not* voted, clicks upvote
|
||||
hook = command;
|
||||
current = 'unvote';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user