Move post_body profile change listener into posts view

Этот коммит содержится в:
JoramWilander
2016-02-22 11:09:35 -05:00
родитель 9b30fad8ad
Коммит c16071afc5
4 изменённых файлов: 28 добавлений и 21 удалений

Просмотреть файл

@@ -33,7 +33,6 @@ 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);
@@ -80,26 +79,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 +342,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);