diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-02-04 14:50:30 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-02-04 14:50:30 -0500 |
commit | ec51c31c325b3dc648a261f0e8634b6d70d7ba73 (patch) | |
tree | 1369b8d2bc406d54770d7ccf52b1e6a8bfedfc05 /web/react/components/post_body.jsx | |
parent | 44c19ee443831e0e94b5738ecb21a64ce7643247 (diff) | |
parent | 21318b7505babaebbb5174c62b75595b2936ebe0 (diff) | |
download | chat-ec51c31c325b3dc648a261f0e8634b6d70d7ba73.tar.gz chat-ec51c31c325b3dc648a261f0e8634b6d70d7ba73.tar.bz2 chat-ec51c31c325b3dc648a261f0e8634b6d70d7ba73.zip |
Merge pull request #2064 from hmhealey/plt882
PLT-882 Ephemeral Messages and Out-Of-Channel mentions
Diffstat (limited to 'web/react/components/post_body.jsx')
-rw-r--r-- | web/react/components/post_body.jsx | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx index 16f8528b2..d71ac6ec7 100644 --- a/web/react/components/post_body.jsx +++ b/web/react/components/post_body.jsx @@ -44,7 +44,6 @@ class PostBody extends React.Component { this.state = { links: linkData.links, - message: linkData.text, post: this.props.post, hasUserProfiles: profiles && Object.keys(profiles).length > 1 }; @@ -106,7 +105,9 @@ class PostBody extends React.Component { if (this.props.post.filenames.length === 0 && this.state.links && this.state.links.length > 0) { this.embed = this.createEmbed(linkData.links[0]); } - this.setState({links: linkData.links, message: linkData.text}); + this.setState({ + links: linkData.links + }); } createEmbed(link) { @@ -310,6 +311,23 @@ class PostBody extends React.Component { ); } + let message; + if (this.props.post.state === Constants.POST_DELETED) { + message = ( + <FormattedMessage + id='post_body.deleted' + defaultMessage='(message deleted)' + /> + ); + } else { + message = ( + <span + onClick={TextFormatting.handleClick} + dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.props.post.message)}} + /> + ); + } + return ( <div> {comment} @@ -320,11 +338,7 @@ class PostBody extends React.Component { className={postClass} > {loading} - <span - ref='message_span' - onClick={TextFormatting.handleClick} - dangerouslySetInnerHTML={{__html: TextFormatting.formatText(this.state.message)}} - /> + {message} </div> <PostBodyAdditionalContent post={this.state.post} @@ -346,4 +360,4 @@ PostBody.propTypes = { handleCommentClick: React.PropTypes.func.isRequired }; -export default injectIntl(PostBody);
\ No newline at end of file +export default injectIntl(PostBody); |