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..637210bc8 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
@@ -21,13 +21,11 @@ exports[`renderSystemMessage uses renderer for Channel Header update 1`] = `
`;
exports[`renderSystemMessage uses renderer for Channel Purpose update 1`] = `
-
+
+ {username} updated the channel purpose from: {oldPurpose} to: {newPurpose}
+
`;
exports[`renderSystemMessage uses renderer for archived channel 1`] = `
diff --git a/app/components/post_body/system_message_helpers.js b/app/components/post_body/system_message_helpers.js
index 7a2d6f1d8..d29db8c61 100644
--- a/app/components/post_body/system_message_helpers.js
+++ b/app/components/post_body/system_message_helpers.js
@@ -2,6 +2,7 @@
// See LICENSE.txt for license information.
import React from 'react';
+import {Text} from 'react-native';
import {Posts} from '@mm-redux/constants';
import Markdown from 'app/components/markdown';
import {t} from 'app/utils/i18n';
@@ -10,10 +11,18 @@ const renderUsername = (value) => {
return (value[0] === '@') ? value : `@${value}`;
};
-const renderMessage = (postBodyProps, styles, intl, localeHolder, values) => {
+const renderMessage = (postBodyProps, styles, intl, localeHolder, values, skipMarkdown = false) => {
const {onPress} = postBodyProps;
const {messageStyle, textStyles} = styles;
+ if (skipMarkdown) {
+ return (
+
+ {intl.formatMessage(localeHolder, values)}
+
+ );
+ }
+
return (
{
};
values = {username, oldPurpose, newPurpose};
- return renderMessage(postBodyProps, styles, intl, localeHolder, values);
+ return renderMessage(postBodyProps, styles, intl, localeHolder, values, true);
}
localeHolder = {
@@ -99,7 +108,7 @@ const renderPurposeChangeMessage = (postBodyProps, styles, intl) => {
};
values = {username, oldPurpose, newPurpose};
- return renderMessage(postBodyProps, styles, intl, localeHolder, values);
+ return renderMessage(postBodyProps, styles, intl, localeHolder, values, true);
} else if (postProps.old_purpose) {
localeHolder = {
id: t('mobile.system_message.update_channel_purpose_message.removed'),
@@ -107,7 +116,7 @@ const renderPurposeChangeMessage = (postBodyProps, styles, intl) => {
};
values = {username, oldPurpose, newPurpose};
- return renderMessage(postBodyProps, styles, intl, localeHolder, values);
+ return renderMessage(postBodyProps, styles, intl, localeHolder, values, true);
}
return null;
diff --git a/app/components/post_body/system_message_helpers.test.js b/app/components/post_body/system_message_helpers.test.js
index 55d2ef93d..2c92a1849 100644
--- a/app/components/post_body/system_message_helpers.test.js
+++ b/app/components/post_body/system_message_helpers.test.js
@@ -1,9 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
-import * as SystemMessageHelpers from './system_message_helpers';
+import renderer from 'react-test-renderer';
import {Posts} from '@mm-redux/constants';
+import * as SystemMessageHelpers from './system_message_helpers';
+
const basePostBodyProps = {
postProps: {
username: 'username',
@@ -62,7 +64,9 @@ describe('renderSystemMessage', () => {
};
const renderedMessage = SystemMessageHelpers.renderSystemMessage(postBodyProps, mockStyles, mockIntl);
- expect(renderedMessage).toMatchSnapshot();
+ const tree = renderer.create(renderedMessage).toJSON();
+ expect(tree).toMatchSnapshot();
+ expect(tree.type).toEqual('Text');
});
test('uses renderer for archived channel', () => {