From 5f71c4d36874961e419bfebea238464cbcf3a9d7 Mon Sep 17 00:00:00 2001 From: Xaekai Date: Tue, 20 Jun 2017 22:29:27 -0700 Subject: [PATCH] Send shadowmuted messages to anons Resolves #689 --- src/channel/chat.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/channel/chat.js b/src/channel/chat.js index b445f31d..95edc63b 100644 --- a/src/channel/chat.js +++ b/src/channel/chat.js @@ -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) { if (user.account.effectiveRank < 2 && this.channel.modules.options) { const firstSeen = user.getFirstSeenTime(); @@ -326,6 +332,10 @@ ChatModule.prototype.processChatMsg = function (user, data) { this.shadowMutedUsers().forEach(function (u) { 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; this.channel.moderators().forEach(function (u) { u.socket.emit("chatMsg", msgobj);