summaryrefslogtreecommitdiffstats
path: root/webapp/actions/post_actions.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/actions/post_actions.jsx')
-rw-r--r--webapp/actions/post_actions.jsx23
1 files changed, 14 insertions, 9 deletions
diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx
index e6daecf31..5319a00c6 100644
--- a/webapp/actions/post_actions.jsx
+++ b/webapp/actions/post_actions.jsx
@@ -20,24 +20,29 @@ const ActionTypes = Constants.ActionTypes;
const Preferences = Constants.Preferences;
export function handleNewPost(post, msg) {
- let websocketMessageProps = null;
+ let websocketMessageProps = {};
if (msg) {
websocketMessageProps = msg.data;
}
- if (msg && msg.data) {
- if (msg.data.channel_type === Constants.DM_CHANNEL) {
- loadNewDMIfNeeded(post.user_id);
- } else if (msg.data.channel_type === Constants.GM_CHANNEL) {
- loadNewGMIfNeeded(post.channel_id, post.user_id);
- }
- }
-
if (ChannelStore.getMyMember(post.channel_id)) {
completePostReceive(post, websocketMessageProps);
} else {
+ // This API call requires any real team id in API v3, so set one if we don't already have one
+ if (!Client.teamId && msg && msg.data) {
+ Client.setTeamId(msg.data.team_id);
+ }
+
AsyncClient.getChannelMember(post.channel_id, UserStore.getCurrentId()).then(() => completePostReceive(post, websocketMessageProps));
}
+
+ if (msg && msg.data) {
+ if (msg.data.channel_type === Constants.DM_CHANNEL) {
+ loadNewDMIfNeeded(post.channel_id);
+ } else if (msg.data.channel_type === Constants.GM_CHANNEL) {
+ loadNewGMIfNeeded(post.channel_id);
+ }
+ }
}
function completePostReceive(post, websocketMessageProps) {