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) {
|
||||
return Rank.Guest;
|
||||
}
|
||||
return Database.lookupChannelRank(this.name, user.name);
|
||||
return Database.lookupChannelRank(this.name, name);
|
||||
}
|
||||
|
||||
Channel.prototype.saveRank = function(user) {
|
||||
|
|
|
@ -180,9 +180,11 @@ exports.lookupChannelRank = function(channame, username) {
|
|||
var query = "SELECT * FROM chan_{1}_ranks WHERE name='{2}'"
|
||||
.replace("{1}", channame)
|
||||
.replace("{2}", username);
|
||||
console.log(query);
|
||||
var results = db.querySync(query);
|
||||
if(!results)
|
||||
if(!results) {
|
||||
return Rank.Guest;
|
||||
}
|
||||
var rows = results.fetchAllSync();
|
||||
if(rows.length == 0) {
|
||||
return Rank.Guest;
|
||||
|
|
4
user.js
4
user.js
|
@ -84,13 +84,13 @@ User.prototype.initCallbacks = function() {
|
|||
|
||||
this.socket.on("promote", function(data) {
|
||||
if(this.channel != null) {
|
||||
this.channel.tryPromote(this, data);
|
||||
this.channel.tryPromoteUser(this, data);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
this.socket.on("demote", function(data) {
|
||||
if(this.channel != null) {
|
||||
this.channel.tryDemote(this, data);
|
||||
this.channel.tryDemoteUser(this, data);
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
|
|
Loading…
Reference in New Issue