Skip to content

Commit

Permalink
Strip markdown from silicon laws before saying them (#28596)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayrtahn authored Jun 8, 2024
1 parent 468728c commit 5f91c3f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Content.Client/Silicons/Laws/Ui/LawDisplay.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Client.Silicons.Laws.Ui;

Expand All @@ -27,6 +28,8 @@ public LawDisplay(EntityUid uid, SiliconLaw law, HashSet<string>? radioChannels)
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);
Expand All @@ -46,7 +49,7 @@ public LawDisplay(EntityUid uid, SiliconLaw law, HashSet<string>? radioChannels)

localButton.OnPressed += _ =>
{
_chatManager.SendMessage($"{lawIdentifier}: {lawDescription}", ChatSelectChannel.Local);
_chatManager.SendMessage($"{lawIdentifierPlaintext}: {lawDescriptionPlaintext}", ChatSelectChannel.Local);
};

LawAnnouncementButtons.AddChild(localButton);
Expand All @@ -73,9 +76,9 @@ public LawDisplay(EntityUid uid, SiliconLaw law, HashSet<string>? radioChannels)
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;
}
};

Expand Down

0 comments on commit 5f91c3f

Please sign in to comment.