From 955e7af2ad7afb721f7c3a48686f3e93cee070ea Mon Sep 17 00:00:00 2001 From: Rane <60792108+Elijahrane@users.noreply.github.com> Date: Sun, 24 Apr 2022 20:15:40 -0400 Subject: [PATCH] Fix capitalization of emotes (#7766) --- Content.Server/Chat/ChatSystem.cs | 9 ++++++--- Content.Server/Chat/Managers/ChatSanitizationManager.cs | 1 + Resources/Locale/en-US/chat/sanitizer-replacements.ftl | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Content.Server/Chat/ChatSystem.cs b/Content.Server/Chat/ChatSystem.cs index f685ef9a66..53c274dae3 100644 --- a/Content.Server/Chat/ChatSystem.cs +++ b/Content.Server/Chat/ChatSystem.cs @@ -91,7 +91,9 @@ public sealed class ChatSystem : EntitySystem if (!CanSendInGame(message, shell, player)) return; - message = SanitizeInGameICMessage(source, message, out var emoteStr); + bool shouldCapitalize = (desiredType != InGameICChatType.Emote); + + message = SanitizeInGameICMessage(source, message, out var emoteStr, shouldCapitalize); // Was there an emote in the message? If so, send it. if (player != null && emoteStr != message && emoteStr != null) @@ -294,10 +296,11 @@ public sealed class ChatSystem : EntitySystem } // ReSharper disable once InconsistentNaming - private string SanitizeInGameICMessage(EntityUid source, string message, out string? emoteStr) + private string SanitizeInGameICMessage(EntityUid source, string message, out string? emoteStr, bool capitalize = true) { var newMessage = message.Trim(); - newMessage = SanitizeMessageCapital(source, newMessage); + if (capitalize) + newMessage = SanitizeMessageCapital(source, newMessage); newMessage = FormattedMessage.EscapeText(newMessage); _sanitizer.TrySanitizeOutSmilies(newMessage, source, out newMessage, out emoteStr); diff --git a/Content.Server/Chat/Managers/ChatSanitizationManager.cs b/Content.Server/Chat/Managers/ChatSanitizationManager.cs index 5c59865d5d..4823bfd411 100644 --- a/Content.Server/Chat/Managers/ChatSanitizationManager.cs +++ b/Content.Server/Chat/Managers/ChatSanitizationManager.cs @@ -65,6 +65,7 @@ public sealed class ChatSanitizationManager : IChatSanitizationManager { "lel", "chatsan-laughs" }, { "kek", "chatsan-laughs" }, { "o7", "chatsan-salutes" }, + { ";_;7", "chatsan-tearfully-salutes"}, { "idk", "chatsan-shrugs" } }; diff --git a/Resources/Locale/en-US/chat/sanitizer-replacements.ftl b/Resources/Locale/en-US/chat/sanitizer-replacements.ftl index fceeebd303..503128d6e2 100644 --- a/Resources/Locale/en-US/chat/sanitizer-replacements.ftl +++ b/Resources/Locale/en-US/chat/sanitizer-replacements.ftl @@ -18,4 +18,5 @@ chatsan-confused = looks confused chatsan-unimpressed = seems unimpressed chatsan-waves = waves chatsan-salutes = salutes +chatsan-tearfully-salutes = tearfully salutes chatsan-shrugs = shrugs