]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Strip markdown from silicon laws before saying them (#28596)
authorTayrtahn <tayrtahn@gmail.com>
Sat, 8 Jun 2024 23:57:07 +0000 (19:57 -0400)
committerGitHub <noreply@github.com>
Sat, 8 Jun 2024 23:57:07 +0000 (09:57 +1000)
Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs

index 4135490416f74b86f15416c6fafe7c524872386a..4e412df85813a5a1fca6f1b2b8d9643b302f635e 100644 (file)
@@ -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;
                 }
             };