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 237c84090..345c6f9bc 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 @@ -30,6 +30,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) => { diff --git a/app/components/post_body/system_message_helpers.test.js b/app/components/post_body/system_message_helpers.test.js index ba6e6d8f4..dae0eaa97 100644 --- a/app/components/post_body/system_message_helpers.test.js +++ b/app/components/post_body/system_message_helpers.test.js @@ -78,6 +78,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,