mirror of https://github.com/calzoneman/sync.git
Bugfix for moderators
This commit is contained in:
parent
0e49f06fbf
commit
66dde5f337
|
@ -172,11 +172,11 @@ Channel.prototype.tryRegister = function(user) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.getRank = function(user) {
|
Channel.prototype.getRank = function(name) {
|
||||||
if(!this.registered) {
|
if(!this.registered) {
|
||||||
return Rank.Guest;
|
return Rank.Guest;
|
||||||
}
|
}
|
||||||
return Database.lookupChannelRank(this.name, user.name);
|
return Database.lookupChannelRank(this.name, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.saveRank = function(user) {
|
Channel.prototype.saveRank = function(user) {
|
||||||
|
|
|
@ -180,9 +180,11 @@ exports.lookupChannelRank = function(channame, username) {
|
||||||
var query = "SELECT * FROM chan_{1}_ranks WHERE name='{2}'"
|
var query = "SELECT * FROM chan_{1}_ranks WHERE name='{2}'"
|
||||||
.replace("{1}", channame)
|
.replace("{1}", channame)
|
||||||
.replace("{2}", username);
|
.replace("{2}", username);
|
||||||
|
console.log(query);
|
||||||
var results = db.querySync(query);
|
var results = db.querySync(query);
|
||||||
if(!results)
|
if(!results) {
|
||||||
return Rank.Guest;
|
return Rank.Guest;
|
||||||
|
}
|
||||||
var rows = results.fetchAllSync();
|
var rows = results.fetchAllSync();
|
||||||
if(rows.length == 0) {
|
if(rows.length == 0) {
|
||||||
return Rank.Guest;
|
return Rank.Guest;
|
||||||
|
|
4
user.js
4
user.js
|
@ -84,13 +84,13 @@ User.prototype.initCallbacks = function() {
|
||||||
|
|
||||||
this.socket.on("promote", function(data) {
|
this.socket.on("promote", function(data) {
|
||||||
if(this.channel != null) {
|
if(this.channel != null) {
|
||||||
this.channel.tryPromote(this, data);
|
this.channel.tryPromoteUser(this, data);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
this.socket.on("demote", function(data) {
|
this.socket.on("demote", function(data) {
|
||||||
if(this.channel != null) {
|
if(this.channel != null) {
|
||||||
this.channel.tryDemote(this, data);
|
this.channel.tryDemoteUser(this, data);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue