diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-11-21 12:17:21 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-11-21 12:17:21 -0500 |
commit | 50ab9626eb61dbb73b89f3435acd900a6e7921bb (patch) | |
tree | 7682ed584ffbd599480338fba94f914e606d1934 | |
parent | 3f19ccf1b1a6efdcc990cf8a0270ec4ffc0c6e22 (diff) | |
download | chat-50ab9626eb61dbb73b89f3435acd900a6e7921bb.tar.gz chat-50ab9626eb61dbb73b89f3435acd900a6e7921bb.tar.bz2 chat-50ab9626eb61dbb73b89f3435acd900a6e7921bb.zip |
Properly load profile for new posts that have unloaded users (#4578)
-rw-r--r-- | webapp/actions/websocket_actions.jsx | 6 | ||||
-rw-r--r-- | webapp/components/rhs_root_post.jsx | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx index 36c6cbdc9..b61d039af 100644 --- a/webapp/actions/websocket_actions.jsx +++ b/webapp/actions/websocket_actions.jsx @@ -18,7 +18,7 @@ import * as Utils from 'utils/utils.jsx'; import * as AsyncClient from 'utils/async_client.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; -import {handleNewPost, loadPosts} from 'actions/post_actions.jsx'; +import {handleNewPost, loadPosts, loadProfilesForPosts} from 'actions/post_actions.jsx'; import {loadProfilesAndTeamMembersForDMSidebar} from 'actions/user_actions.jsx'; import {loadChannelsForCurrentUser} from 'actions/channel_actions.jsx'; import * as StatusActions from 'actions/status_actions.jsx'; @@ -172,6 +172,10 @@ function handleNewPostEvent(msg) { const post = JSON.parse(msg.data.post); handleNewPost(post, msg); + const posts = {}; + posts[post.id] = post; + loadProfilesForPosts(posts); + if (UserStore.getStatus(post.user_id) !== UserStatuses.ONLINE) { StatusActions.loadStatusesByIds([post.user_id]); } diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx index 0dae5976f..22795967a 100644 --- a/webapp/components/rhs_root_post.jsx +++ b/webapp/components/rhs_root_post.jsx @@ -90,7 +90,7 @@ export default class RhsRootPost extends React.Component { var isOwner = this.props.currentUser.id === post.user_id; var isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser(); const isSystemMessage = post.type && post.type.startsWith(Constants.SYSTEM_MESSAGE_PREFIX); - var timestamp = user.update_at; + var timestamp = user ? user.update_at : 0; var channel = ChannelStore.get(post.channel_id); const flagIcon = Constants.FLAG_ICON_SVG; |