summaryrefslogtreecommitdiffstats
path: root/web/react/components/post_body.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-02-23 14:34:06 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2016-02-23 14:34:06 -0500
commit0031c6fd1a4df621cbecfd2a2b3efe9a40cd49ce (patch)
tree2afcb0888267be4cf59df2d0e8f5085d6aacccb0 /web/react/components/post_body.jsx
parent11093ddb51a70622287aac20108be6c6aa2eb76d (diff)
parent1f049af2b7ea41a5e1e79a8263e10fa58f186c8d (diff)
downloadchat-0031c6fd1a4df621cbecfd2a2b3efe9a40cd49ce.tar.gz
chat-0031c6fd1a4df621cbecfd2a2b3efe9a40cd49ce.tar.bz2
chat-0031c6fd1a4df621cbecfd2a2b3efe9a40cd49ce.zip
Merge pull request #2229 from mattermost/plt-1770
PLT-1770 Refactor store listeners out of highly used components
Diffstat (limited to 'web/react/components/post_body.jsx')
-rw-r--r--web/react/components/post_body.jsx22
1 files changed, 3 insertions, 19 deletions
diff --git a/web/react/components/post_body.jsx b/web/react/components/post_body.jsx
index d71ac6ec7..b187acba3 100644
--- a/web/react/components/post_body.jsx
+++ b/web/react/components/post_body.jsx
@@ -33,19 +33,16 @@ class PostBody extends React.Component {
this.isImgLoading = false;
- this.handleUserChange = this.handleUserChange.bind(this);
this.parseEmojis = this.parseEmojis.bind(this);
this.createEmbed = this.createEmbed.bind(this);
this.createImageEmbed = this.createImageEmbed.bind(this);
this.loadImg = this.loadImg.bind(this);
const linkData = Utils.extractLinks(this.props.post.message);
- const profiles = UserStore.getProfiles();
this.state = {
links: linkData.links,
- post: this.props.post,
- hasUserProfiles: profiles && Object.keys(profiles).length > 1
+ post: this.props.post
};
}
@@ -80,26 +77,12 @@ class PostBody extends React.Component {
componentDidMount() {
this.parseEmojis();
-
- UserStore.addChangeListener(this.handleUserChange);
}
componentDidUpdate() {
this.parseEmojis();
}
- componentWillUnmount() {
- UserStore.removeChangeListener(this.handleUserChange);
- }
-
- handleUserChange() {
- if (!this.state.hasProfiles) {
- const profiles = UserStore.getProfiles();
-
- this.setState({hasProfiles: profiles && Object.keys(profiles).length > 1});
- }
- }
-
componentWillReceiveProps(nextProps) {
const linkData = Utils.extractLinks(nextProps.post.message);
if (this.props.post.filenames.length === 0 && this.state.links && this.state.links.length > 0) {
@@ -357,7 +340,8 @@ PostBody.propTypes = {
post: React.PropTypes.object.isRequired,
parentPost: React.PropTypes.object,
retryPost: React.PropTypes.func.isRequired,
- handleCommentClick: React.PropTypes.func.isRequired
+ handleCommentClick: React.PropTypes.func.isRequired,
+ hasProfiles: React.PropTypes.bool
};
export default injectIntl(PostBody);