diff --git a/ui/src/Components/ManagedSilence/SilenceComment.js b/ui/src/Components/ManagedSilence/SilenceComment.js index a171c3b7e..a918a2973 100644 --- a/ui/src/Components/ManagedSilence/SilenceComment.js +++ b/ui/src/Components/ManagedSilence/SilenceComment.js @@ -11,15 +11,27 @@ import { APISilence } from "Models/API"; import { SilenceProgress } from "./SilenceProgress"; const SilenceComment = ({ silence, collapsed, afterUpdate }) => { - const comment = ( + const commentBody = ( + + {silence.comment} + + ); + const comment = silence.jiraURL ? ( + + + {commentBody} + + ) : ( + commentBody + ); + + return (
- - {silence.comment} - + {comment} {silence.createdBy} @@ -29,15 +41,6 @@ const SilenceComment = ({ silence, collapsed, afterUpdate }) => {
); - if (silence.jiraURL) { - return ( - - - {comment} - - ); - } - return {comment}; }; SilenceComment.propTypes = { silence: APISilence.isRequired, diff --git a/ui/src/Components/ManagedSilence/SilenceComment.test.js b/ui/src/Components/ManagedSilence/SilenceComment.test.js index d75beb5d5..6cf31d977 100644 --- a/ui/src/Components/ManagedSilence/SilenceComment.test.js +++ b/ui/src/Components/ManagedSilence/SilenceComment.test.js @@ -39,4 +39,11 @@ describe("", () => { const tree = MountedSilenceComment(true); expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1); }); + + it("Renders a JIRA link if present and comment is expanded", () => { + silence.jiraURL = "http://localhost/1234"; + silence.jiraID = "1234"; + const tree = MountedSilenceComment(false); + expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1); + }); });