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)); 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) { VoteskipModule.prototype.handleVoteskip = function (user) {
if (!this.channel.modules.options.get("allow_voteskip")) { if (!this.channel.modules.options.get("allow_voteskip")) {
return; return;
@ -44,6 +53,14 @@ VoteskipModule.prototype.handleVoteskip = function (user) {
this.update(); this.update();
}; };
VoteskipModule.prototype.unvote = function(ip) {
if (!this.poll) {
return;
}
this.poll.unvote(ip);
};
VoteskipModule.prototype.update = function () { VoteskipModule.prototype.update = function () {
if (!this.channel.modules.options.get("allow_voteskip")) { if (!this.channel.modules.options.get("allow_voteskip")) {
return; return;

View File

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