summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-01-31 08:01:32 -0500
committerenahum <nahumhbl@gmail.com>2017-01-31 10:01:32 -0300
commitc0c6ef47d99994ae5fb20c7fb429411b6f8eb328 (patch)
treed6b570ca4ff02e1a011d51abe0bcf5092912be6f
parentcec05e280e3b02c8709e885767f1bf24dba2d9bd (diff)
downloadchat-c0c6ef47d99994ae5fb20c7fb429411b6f8eb328.tar.gz
chat-c0c6ef47d99994ae5fb20c7fb429411b6f8eb328.tar.bz2
chat-c0c6ef47d99994ae5fb20c7fb429411b6f8eb328.zip
Stopped usernames from appearing on separate lines in system messages (#5228)
-rw-r--r--webapp/components/post_view/components/system_message_helpers.jsx22
1 files changed, 13 insertions, 9 deletions
diff --git a/webapp/components/post_view/components/system_message_helpers.jsx b/webapp/components/post_view/components/system_message_helpers.jsx
index 6f6454599..5db4ff871 100644
--- a/webapp/components/post_view/components/system_message_helpers.jsx
+++ b/webapp/components/post_view/components/system_message_helpers.jsx
@@ -7,12 +7,16 @@ import {FormattedMessage} from 'react-intl';
import {PostTypes} from 'utils/constants.jsx';
import {formatText} from 'utils/text_formatting.jsx';
+function renderUsername(value, options) {
+ return renderFormattedText(value, {...options, markdown: false});
+}
+
function renderFormattedText(value, options) {
return <span dangerouslySetInnerHTML={{__html: formatText(value, options)}}/>;
}
function renderJoinChannelMessage(post, options) {
- const username = renderFormattedText(post.props.username, options);
+ const username = renderUsername(post.props.username, options);
return (
<FormattedMessage
@@ -24,7 +28,7 @@ function renderJoinChannelMessage(post, options) {
}
function renderLeaveChannelMessage(post, options) {
- const username = renderFormattedText(post.props.username, options);
+ const username = renderUsername(post.props.username, options);
return (
<FormattedMessage
@@ -36,8 +40,8 @@ function renderLeaveChannelMessage(post, options) {
}
function renderAddToChannelMessage(post, options) {
- const username = renderFormattedText(post.props.username, options);
- const addedUsername = renderFormattedText(post.props.addedUsername, options);
+ const username = renderUsername(post.props.username, options);
+ const addedUsername = renderUsername(post.props.addedUsername, options);
return (
<FormattedMessage
@@ -52,7 +56,7 @@ function renderAddToChannelMessage(post, options) {
}
function renderRemoveFromChannelMessage(post, options) {
- const removedUsername = renderFormattedText(post.props.removedUsername, options);
+ const removedUsername = renderUsername(post.props.removedUsername, options);
return (
<FormattedMessage
@@ -75,7 +79,7 @@ function renderHeaderChangeMessage(post, options) {
singleline: true
};
- const username = renderFormattedText(post.props.username, options);
+ const username = renderUsername(post.props.username, options);
const oldHeader = post.props.old_header ? renderFormattedText(post.props.old_header, headerOptions) : null;
const newHeader = post.props.new_header ? renderFormattedText(post.props.new_header, headerOptions) : null;
@@ -125,7 +129,7 @@ function renderDisplayNameChangeMessage(post, options) {
return null;
}
- const username = renderFormattedText(post.props.username, options);
+ const username = renderUsername(post.props.username, options);
const oldDisplayName = post.props.old_displayname;
const newDisplayName = post.props.new_displayname;
@@ -147,7 +151,7 @@ function renderPurposeChangeMessage(post, options) {
return null;
}
- const username = renderFormattedText(post.props.username, options);
+ const username = renderUsername(post.props.username, options);
const oldPurpose = post.props.old_purpose;
const newPurpose = post.props.new_purpose;
@@ -197,7 +201,7 @@ function renderChannelDeletedMessage(post, options) {
return null;
}
- const username = renderFormattedText(post.props.username, options);
+ const username = renderUsername(post.props.username, options);
return (
<FormattedMessage