Send shadowmuted messages to anons

Resolves #689
This commit is contained in:
Xaekai 2017-06-20 22:29:27 -07:00
parent a96f7976d8
commit 5f71c4d368
1 changed files with 10 additions and 0 deletions

View File

@ -122,6 +122,12 @@ ChatModule.prototype.shadowMutedUsers = function () {
}); });
}; };
ChatModule.prototype.anonymousUsers = function () {
return this.channel.users.filter(function (u) {
return u.getName() === "";
});
};
ChatModule.prototype.restrictNewAccount = function restrictNewAccount(user, data) { ChatModule.prototype.restrictNewAccount = function restrictNewAccount(user, data) {
if (user.account.effectiveRank < 2 && this.channel.modules.options) { if (user.account.effectiveRank < 2 && this.channel.modules.options) {
const firstSeen = user.getFirstSeenTime(); const firstSeen = user.getFirstSeenTime();
@ -326,6 +332,10 @@ ChatModule.prototype.processChatMsg = function (user, data) {
this.shadowMutedUsers().forEach(function (u) { this.shadowMutedUsers().forEach(function (u) {
u.socket.emit("chatMsg", msgobj); u.socket.emit("chatMsg", msgobj);
}); });
// This prevents shadowmuted users from easily detecting their state
this.anonymousUsers().forEach(function (u) {
u.socket.emit("chatMsg", msgobj);
});
msgobj.meta.shadow = true; msgobj.meta.shadow = true;
this.channel.moderators().forEach(function (u) { this.channel.moderators().forEach(function (u) {
u.socket.emit("chatMsg", msgobj); u.socket.emit("chatMsg", msgobj);