Fix #340; add shadowchat option for moderators

The new option allows moderators to see what shadowmuted users are saying.  When enabled, messages from shadowmuted users will appear in a darker (or lighter, depending on theme) font and struck through.
This commit is contained in:
Calvin Montgomery 2014-04-01 11:52:20 -05:00
parent 37db972d86
commit 42e590c6fd
9 changed files with 43 additions and 8 deletions

View File

@ -2895,13 +2895,7 @@ Channel.prototype.handleChat = function (user, data) {
user.socket.emit("chatCooldown", 1000 / this.opts.chat_antiflood_params.sustained);
}
if (muted) {
user.socket.emit("noflood", {
action: "chat",
msg: "You have been muted on this channel."
});
return;
} else if (smuted) {
if (smuted) {
msg = XSS.sanitizeText(msg);
msg = this.filterMessage(msg);
var msgobj = {
@ -2913,6 +2907,17 @@ Channel.prototype.handleChat = function (user, data) {
this.shadowMutedUsers().forEach(function (u) {
u.socket.emit("chatMsg", msgobj);
});
msgobj.meta.shadow = true;
this.channelModerators().forEach(function (u) {
u.socket.emit("chatMsg", msgobj);
});
return;
} else if (muted) {
user.socket.emit("noflood", {
action: "chat",
msg: "You have been muted on this channel."
});
return;
}

View File

@ -98,3 +98,4 @@ mixin us-mod
form.form-horizontal(action="javascript:void(0)")
mixin rcheckbox("us-modflair", "Show name color")
mixin rcheckbox("us-joinmessage", "Show join messages")
mixin rcheckbox("us-shadowchat", "Show shadowmuted messages")

View File

@ -554,3 +554,7 @@ body.chatOnly .pm-panel, body.chatOnly .pm-panel-placeholder {
border-top-left-radius: 0!important;
border-top-right-radius: 0!important;
}
.chat-shadow {
text-decoration: line-through;
}

View File

@ -35,3 +35,7 @@ footer {
.profile-box, .user-dropdown {
background-color: #ffffff;
}
.chat-shadow {
color: #aaaaaa;
}

View File

@ -7725,3 +7725,7 @@ input.form-control[type="email"], textarea.form-control {
color: #c8c8c8;
background-color: #2d2d2d;
}
.chat-shadow {
color: #777777;
}

View File

@ -25,3 +25,7 @@ footer {
.profile-box, .user-dropdown {
background-color: #ffffff;
}
.chat-shadow {
color: #aaaaaa;
}

View File

@ -8012,3 +8012,7 @@ input.form-control[type="email"], textarea.form-control {
.poll-notify {
color: #ff9900;
}
.chat-shadow {
color: #777777;
}

View File

@ -134,7 +134,8 @@ var USEROPTS = {
default_quality : getOrDefault("default_quality", ""),
boop : getOrDefault("boop", false),
secure_connection : getOrDefault("secure_connection", false),
no_h264 : getOrDefault("no_h264", default_noh264())
no_h264 : getOrDefault("no_h264", default_noh264()),
show_shadowchat : getOrDefault("show_shadowchat", false)
};
var VOLUME = parseFloat(getOrDefault("volume", 1));

View File

@ -616,6 +616,7 @@ function showUserOptions() {
$("#us-modflair").prop("checked", USEROPTS.modhat);
$("#us-joinmessage").prop("checked", USEROPTS.joinmessage);
$("#us-shadowchat").prop("checked", USEROPTS.show_shadowchat);
$("a[href='#us-general']").click();
$("#useroptions").modal();
@ -648,6 +649,7 @@ function saveUserOptions() {
if (CLIENT.rank >= 2) {
USEROPTS.modhat = $("#us-modflair").prop("checked");
USEROPTS.joinmessage = $("#us-joinmessage").prop("checked");
USEROPTS.show_shadowchat = $("#us-shadowchat").prop("checked");
}
storeOpts();
@ -1357,6 +1359,9 @@ function formatChatMessage(data, last) {
if (data.meta.addClass) {
message.addClass(data.meta.addClass);
}
if (data.meta.shadow) {
div.addClass("chat-shadow");
}
return div;
}
@ -1364,6 +1369,9 @@ function addChatMessage(data) {
if(IGNORED.indexOf(data.username) !== -1) {
return;
}
if (data.meta.shadow && !USEROPTS.show_shadowchat) {
return;
}
var div = formatChatMessage(data, LASTCHAT);
// Incoming: a bunch of crap for the feature where if you hover over
// a message, it highlights messages from that user