diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-14 00:56:37 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-14 00:56:37 -0400 |
commit | 975159b52ac6bf0ee6b2d5b73d2391b2e0c6e165 (patch) | |
tree | a0852f9faf6de9962b5478ed3f1bbaccd71062c0 /web/react/components/posts_view.jsx | |
parent | 160e1a8bea6d8280ef3b41a4a9f80674b75f3eb0 (diff) | |
parent | d7cdcf082fab6c0cb7c2fe4bed821bd1a8000e69 (diff) | |
download | chat-975159b52ac6bf0ee6b2d5b73d2391b2e0c6e165.tar.gz chat-975159b52ac6bf0ee6b2d5b73d2391b2e0c6e165.tar.bz2 chat-975159b52ac6bf0ee6b2d5b73d2391b2e0c6e165.zip |
Merge pull request #2331 from mattermost/plt-1680
PLT-1680 Converting client to react-router. Stage 1
Diffstat (limited to 'web/react/components/posts_view.jsx')
-rw-r--r-- | web/react/components/posts_view.jsx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/web/react/components/posts_view.jsx b/web/react/components/posts_view.jsx index c2c739e9a..0a9232850 100644 --- a/web/react/components/posts_view.jsx +++ b/web/react/components/posts_view.jsx @@ -1,9 +1,8 @@ // Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import UserStore from '../stores/user_store.jsx'; import PreferenceStore from '../stores/preference_store.jsx'; -import * as EventHelpers from '../dispatcher/event_helpers.jsx'; +import * as GlobalActions from '../action_creators/global_actions.jsx'; import * as Utils from '../utils/utils.jsx'; import Post from './post.jsx'; import Constants from '../utils/constants.jsx'; @@ -144,7 +143,7 @@ export default class PostsView extends React.Component { createPosts(posts, order) { const postCtls = []; let previousPostDay = new Date(0); - const userId = UserStore.getCurrentId(); + const userId = this.props.currentUser.id; const profiles = this.props.profiles || {}; let renderedLastViewed = false; @@ -230,8 +229,8 @@ export default class PostsView extends React.Component { const shouldHighlight = this.props.postsToHighlight && this.props.postsToHighlight.hasOwnProperty(post.id); let profile; - if (UserStore.getCurrentId() === post.user_id) { - profile = UserStore.getCurrentUser(); + if (this.props.currentUser.id === post.user_id) { + profile = this.props.currentUser; } else { profile = profiles[post.user_id]; } @@ -248,9 +247,10 @@ export default class PostsView extends React.Component { hideProfilePic={hideProfilePic} isLastComment={isLastComment} shouldHighlight={shouldHighlight} - onClick={() => EventHelpers.emitPostFocusEvent(post.id)} //eslint-disable-line no-loop-func + onClick={() => GlobalActions.emitPostFocusEvent(post.id)} //eslint-disable-line no-loop-func displayNameType={this.state.displayNameType} user={profile} + currentUser={this.props.currentUser} /> ); @@ -525,7 +525,7 @@ PostsView.defaultProps = { PostsView.propTypes = { isActive: React.PropTypes.bool, postList: React.PropTypes.object, - profiles: React.PropTypes.object, + profiles: React.PropTypes.object.isRequired, scrollPostId: React.PropTypes.string, scrollType: React.PropTypes.number, postViewScrolled: React.PropTypes.func.isRequired, @@ -535,7 +535,8 @@ PostsView.propTypes = { showMoreMessagesBottom: React.PropTypes.bool, introText: React.PropTypes.element, messageSeparatorTime: React.PropTypes.number, - postsToHighlight: React.PropTypes.object + postsToHighlight: React.PropTypes.object, + currentUser: React.PropTypes.object.isRequired }; function FloatingTimestamp({isScrolling, post}) { |