voteskip: add early exit for duplicate votes
This commit is contained in:
parent
f6a58d00b2
commit
2d6af31c00
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "3.60.0",
|
||||
"version": "3.60.1",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -40,7 +40,10 @@ VoteskipModule.prototype.handleVoteskip = function (user) {
|
|||
this.poll = new Poll("[server]", "voteskip", ["skip"], false);
|
||||
}
|
||||
|
||||
this.poll.vote(user.realip, 0);
|
||||
if (!this.poll.vote(user.realip, 0)) {
|
||||
// Vote was already recorded for this IP, no update needed
|
||||
return;
|
||||
}
|
||||
|
||||
var title = "";
|
||||
if (this.channel.modules.playlist.current) {
|
||||
|
|
|
@ -24,7 +24,9 @@ Poll.prototype.vote = function(ip, option) {
|
|||
if(!(ip in this.votes) || this.votes[ip] == null) {
|
||||
this.votes[ip] = option;
|
||||
this.counts[option]++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Poll.prototype.unvote = function(ip) {
|
||||
|
|
Loading…
Reference in a new issue