summaryrefslogtreecommitdiffstats
path: root/web/react/components/search_results.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-02-26 11:19:05 -0500
committerChristopher Speller <crspeller@gmail.com>2016-02-26 11:19:05 -0500
commit53d0bce1da190d45ffd8dbf4afcf7e8b2878bad5 (patch)
tree53043d11186353b54e107466e72c55178e874a22 /web/react/components/search_results.jsx
parent3734145f9676946792a3efab842812e547cbdab1 (diff)
parentd563bf11527698bef02fc4b17852e260ba43f4e8 (diff)
downloadchat-53d0bce1da190d45ffd8dbf4afcf7e8b2878bad5.tar.gz
chat-53d0bce1da190d45ffd8dbf4afcf7e8b2878bad5.tar.bz2
chat-53d0bce1da190d45ffd8dbf4afcf7e8b2878bad5.zip
Merge pull request #2257 from mattermost/rhs-profile-fix
Final fixes for user store changes
Diffstat (limited to 'web/react/components/search_results.jsx')
-rw-r--r--web/react/components/search_results.jsx20
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}
/>