fix? #371 coming out of afk doesn't enable voteskip button if it's on the same media

This commit is contained in:
Erik 2014-05-31 10:31:45 -04:00
parent b10a2af1ad
commit 13f5e3a2c8
2 changed files with 19 additions and 2 deletions

View file

@ -14,6 +14,15 @@ VoteskipModule.prototype.onUserPostJoin = function (user) {
user.socket.on("voteskip", this.handleVoteskip.bind(this, user));
};
VoteskipModule.prototype.onUserPart = function(user) {
if (!this.poll) {
return;
}
this.unvote(user.ip);
this.update();
};
VoteskipModule.prototype.handleVoteskip = function (user) {
if (!this.channel.modules.options.get("allow_voteskip")) {
return;
@ -44,6 +53,14 @@ VoteskipModule.prototype.handleVoteskip = function (user) {
this.update();
};
VoteskipModule.prototype.unvote = function(ip) {
if (!this.poll) {
return;
}
this.poll.unvote(ip);
};
VoteskipModule.prototype.update = function () {
if (!this.channel.modules.options.get("allow_voteskip")) {
return;

View file

@ -175,8 +175,8 @@ User.prototype.setAFK = function (afk) {
if (afk) {
this.setFlag(Flags.U_AFK);
if (this.channel.voteskip) {
this.channel.voteskip.unvote(this.ip);
if (this.channel.modules.voteskip) {
this.channel.modules.voteskip.unvote(this.ip);
}
} else {
this.clearFlag(Flags.U_AFK);