diff options
Diffstat (limited to 'web/react')
-rw-r--r-- | web/react/components/create_post.jsx | 7 | ||||
-rw-r--r-- | web/react/components/post_body.jsx | 30 | ||||
-rw-r--r-- | web/react/stores/post_store.jsx | 4 |
3 files changed, 23 insertions, 18 deletions
diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index ed672cd34..3dfc91970 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -40,10 +40,6 @@ const holders = defineMessages({ write: { id: 'create_post.write', defaultMessage: 'Write a message...' - }, - deleteMsg: { - id: 'create_post.deleteMsg', - defaultMessage: '(message deleted)' } }); @@ -70,7 +66,6 @@ class CreatePost extends React.Component { this.sendMessage = this.sendMessage.bind(this); PostStore.clearDraftUploads(); - PostStore.deleteMessage(this.props.intl.formatMessage(holders.deleteMsg)); const draft = this.getCurrentDraft(); @@ -511,4 +506,4 @@ CreatePost.propTypes = { intl: intlShape.isRequired }; -export default injectIntl(CreatePost);
\ No newline at end of file +export default injectIntl(CreatePost); 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); diff --git a/web/react/stores/post_store.jsx b/web/react/stores/post_store.jsx index 93e565403..a504fef89 100644 --- a/web/react/stores/post_store.jsx +++ b/web/react/stores/post_store.jsx @@ -341,7 +341,6 @@ class PostStoreClass extends EventEmitter { if (post.id in postList.posts) { // make sure to copy the post so that component state changes work properly postList.posts[post.id] = Object.assign({}, post, { - message: this.delete_message, // TODO state: Constants.POST_DELETED, filenames: [], ephemeral: true @@ -534,9 +533,6 @@ class PostStoreClass extends EventEmitter { return commentCount; } - deleteMessage(msg) { - this.delete_message = msg; - } } var PostStore = new PostStoreClass(); |