diff options
Diffstat (limited to 'web/react/components/search_results.jsx')
-rw-r--r-- | web/react/components/search_results.jsx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/web/react/components/search_results.jsx b/web/react/components/search_results.jsx index 55ece2c97..8985063a0 100644 --- a/web/react/components/search_results.jsx +++ b/web/react/components/search_results.jsx @@ -61,7 +61,15 @@ export default class SearchResults extends React.Component { } shouldComponentUpdate(nextProps, nextState) { - return !Utils.areObjectsEqual(this.props, nextProps) || !Utils.areObjectsEqual(this.state, nextState); + if (!Utils.areObjectsEqual(this.props, nextProps)) { + return true; + } + + if (!Utils.areObjectsEqual(this.state, nextState)) { + return true; + } + + return false; } componentDidUpdate() { @@ -143,13 +151,19 @@ export default class SearchResults extends React.Component { ); } else { ctls = results.order.map(function mymap(id) { - var post = results.posts[id]; + const post = results.posts[id]; + let profile; + if (UserStore.getCurrentId() === post.user_id) { + profile = UserStore.getCurrentUser(); + } else { + profile = profiles[post.user_id]; + } return ( <SearchResultsItem key={post.id} channel={this.state.channels.get(post.channel_id)} post={post} - user={profiles[post.user_id]} + user={profile} term={searchTerm} isMentionSearch={this.props.isMentionSearch} /> |