From 5f91c3f27f2d6d8cb67413d2e85f3fa13a38d89a Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Sat, 8 Jun 2024 19:57:07 -0400 Subject: [PATCH] Strip markdown from silicon laws before saying them (#28596) --- Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs index 4135490416..4e412df858 100644 --- a/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs +++ b/Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs @@ -9,6 +9,7 @@ using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; using Robust.Shared.Prototypes; +using Robust.Shared.Utility; namespace Content.Client.Silicons.Laws.Ui; @@ -27,6 +28,8 @@ public sealed partial class LawDisplay : Control var identifier = law.LawIdentifierOverride ?? $"{law.Order}"; var lawIdentifier = Loc.GetString("laws-ui-law-header", ("id", identifier)); var lawDescription = Loc.GetString(law.LawString); + var lawIdentifierPlaintext = FormattedMessage.RemoveMarkupPermissive(lawIdentifier); + var lawDescriptionPlaintext = FormattedMessage.RemoveMarkupPermissive(lawDescription); LawNumberLabel.SetMarkup(lawIdentifier); LawLabel.SetMessage(lawDescription); @@ -46,7 +49,7 @@ public sealed partial class LawDisplay : Control localButton.OnPressed += _ => { - _chatManager.SendMessage($"{lawIdentifier}: {lawDescription}", ChatSelectChannel.Local); + _chatManager.SendMessage($"{lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Local); }; LawAnnouncementButtons.AddChild(localButton); @@ -73,9 +76,9 @@ public sealed partial class LawDisplay : Control switch (radioChannel) { case SharedChatSystem.CommonChannel: - _chatManager.SendMessage($"{SharedChatSystem.RadioCommonPrefix} {lawIdentifier}: {lawDescription}", ChatSelectChannel.Radio); break; + _chatManager.SendMessage($"{SharedChatSystem.RadioCommonPrefix} {lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Radio); break; default: - _chatManager.SendMessage($"{SharedChatSystem.RadioChannelPrefix}{radioChannelProto.KeyCode} {lawIdentifier}: {lawDescription}", ChatSelectChannel.Radio); break; + _chatManager.SendMessage($"{SharedChatSystem.RadioChannelPrefix}{radioChannelProto.KeyCode} {lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Radio); break; } };