diff --git a/lib/channel-new.js b/lib/channel-new.js index 70be6b3b..04dcc757 100644 --- a/lib/channel-new.js +++ b/lib/channel-new.js @@ -1404,7 +1404,6 @@ Channel.prototype.handleQueue = function (user, data) { maxlength: this.hasPermission(user, "exceedmaxlength") ? 0 : this.opts.maxlength }, function (err, media) { if (err) { - console.log(err); user.socket.emit("queueFail", { msg: err, link: link @@ -2539,20 +2538,42 @@ Channel.prototype.handleSetRank = function (user, data) { var updateDB = function () { self.getRank(name, function (err, oldrank) { - if (self.dead || err) { + if (self.dead) { + return; + } + + if (err) { + user.socket.emit("channelRankFail", { + msg: "Updating user rank failed: " + err + }); return; } if (oldrank >= user.rank) { + user.socket.emit("channelRankFail", { + msg: "Updating user rank failed: " + name + " has equal or higher " + + "rank than you" + }); return; } db.channels.setRank(self.name, name, rank, function (err, res) { - if (self.dead || err) { + if (self.dead) { + return; + } + + if (err) { + user.socket.emit("channelRankFail", { + msg: "Updating user rank failed: " + err + }); return; } self.logger.log("*** " + user.name + " set " + name + "'s rank to " + rank); + self.sendAll("setUserRank", { + name: name, + rank: rank + }); }); }); }; @@ -2565,11 +2586,6 @@ Channel.prototype.handleSetRank = function (user, data) { if (receiver.loggedIn) { updateDB(); } - - self.sendAll("setUserRank", { - name: name, - rank: rank - }); } else if (self.registered) { updateDB(); } diff --git a/templates/channel.jade b/templates/channel.jade index 69057bdc..e124673f 100644 --- a/templates/channel.jade +++ b/templates/channel.jade @@ -167,7 +167,7 @@ html(lang="en") li: a(href="#cs-motdeditor", data-toggle="tab", tabindex="-1") Edit MOTD li: a(href="#cs-csseditor", data-toggle="tab", tabindex="-1") Edit CSS li: a(href="#cs-jseditor", data-toggle="tab", tabindex="-1") Edit Javascript - li: a(href="#cs-chanranks", data-toggle="tab", tabindex="-1", onclick="javascript:socket.emit('requestChannelRanks')") Edit user ranks + li: a(href="#cs-chanranks", data-toggle="tab", tabindex="-1", onclick="javascript:socket.emit('requestChannelRanks')") Edit moderators li: a(href="#cs-banlist", data-toggle="tab", tabindex="-1", onclick="javascript:socket.emit('requestBanlist')") Ban list .modal-body .tab-content diff --git a/templates/channeloptions.jade b/templates/channeloptions.jade index 4af9187d..14e518b1 100644 --- a/templates/channeloptions.jade +++ b/templates/channeloptions.jade @@ -92,6 +92,12 @@ mixin recentjoins mixin chanranks #cs-chanranks.tab-pane + form.form-inline(action="javascript:void(0)", role="form") + .input-group + input#cs-chanranks-name.form-control(type="text", placeholder="Name") + span.input-group-btn + button#cs-chanranks-mod.btn.btn-success +Mod + button#cs-chanranks-adm.btn.btn-info +Admin table.table.table-striped thead tr diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index b6b4eef0..32a7aa7a 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -505,7 +505,7 @@ Callbacks = { }); entries.forEach(function (entry) { - var tr = $("