diff --git a/ui/src/Components/ManagedSilence/SilenceComment.test.tsx b/ui/src/Components/ManagedSilence/SilenceComment.test.tsx
index 5db19e7ad..24926cde8 100644
--- a/ui/src/Components/ManagedSilence/SilenceComment.test.tsx
+++ b/ui/src/Components/ManagedSilence/SilenceComment.test.tsx
@@ -110,13 +110,15 @@ describe("", () => {
it("Renders a JIRA link if present", () => {
silence.ticketURL = "http://localhost/1234";
silence.ticketID = "1234";
+ silence.comment = "Ticket id 1234 and also 1234";
const tree = MountedSilenceComment(true);
- expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1);
+ expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(2);
});
it("Renders a JIRA link if present and comment is expanded", () => {
silence.ticketURL = "http://localhost/1234";
silence.ticketID = "1234";
+ silence.comment = "Ticket id 1234";
const tree = MountedSilenceComment(false);
expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1);
});
diff --git a/ui/src/Components/ManagedSilence/SilenceComment.tsx b/ui/src/Components/ManagedSilence/SilenceComment.tsx
index 481815feb..6bd276b97 100644
--- a/ui/src/Components/ManagedSilence/SilenceComment.tsx
+++ b/ui/src/Components/ManagedSilence/SilenceComment.tsx
@@ -27,22 +27,20 @@ const SilenceComment: FC<{
collapseToggle,
alertStore,
}) => {
- const comment = silence.ticketURL ? (
-
-
- {silence.comment}
-
- ) : (
- silence.comment
+ const comment = silence.comment.split(" ").map((w, i) =>
+ silence.ticketURL && w === silence.ticketID ? (
+
+
+ {silence.ticketID}
+
+ ) : (
+ " " + w
+ )
);
return (
@@ -60,7 +58,7 @@ const SilenceComment: FC<{
collapsed ? "text-truncate overflow-hidden" : ""
}`}
>
- {comment}
+ {comment.map((w) => w)}