diff --git a/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap b/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap index 637210bc8..dec7b4db1 100644 --- a/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap +++ b/app/components/post_body/__snapshots__/system_message_helpers.test.js.snap @@ -28,6 +28,16 @@ exports[`renderSystemMessage uses renderer for Channel Purpose update 1`] = ` `; +exports[`renderSystemMessage uses renderer for OLD archived channel without a username 1`] = ` + +`; + exports[`renderSystemMessage uses renderer for archived channel 1`] = ` { - return (value[0] === '@') ? value : `@${value}`; +const renderUsername = (value = '') => { + if (value) { + return (value[0] === '@') ? value : `@${value}`; + } + + return value; }; const renderMessage = (postBodyProps, styles, intl, localeHolder, values, skipMarkdown = false) => { diff --git a/app/components/post_body/system_message_helpers.test.js b/app/components/post_body/system_message_helpers.test.js index 2c92a1849..036f55cc3 100644 --- a/app/components/post_body/system_message_helpers.test.js +++ b/app/components/post_body/system_message_helpers.test.js @@ -82,6 +82,17 @@ describe('renderSystemMessage', () => { expect(renderedMessage).toMatchSnapshot(); }); + test('uses renderer for OLD archived channel without a username', () => { + const postBodyProps = { + ...basePostBodyProps, + postProps: {}, + postType: Posts.POST_TYPES.CHANNEL_DELETED, + }; + + const renderedMessage = SystemMessageHelpers.renderSystemMessage(postBodyProps, mockStyles, mockIntl); + expect(renderedMessage).toMatchSnapshot(); + }); + test('uses renderer for unarchived channel', () => { const postBodyProps = { ...basePostBodyProps,