summaryrefslogtreecommitdiffstats
path: root/webapp/actions/post_actions.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-04-17 15:08:56 -0400
committerChristopher Speller <crspeller@gmail.com>2017-04-17 15:08:56 -0400
commit92d8fa4aa8af170d0018baed94a8787d06297e44 (patch)
treedc5000a3584952c797c03bf4331282a5e1536848 /webapp/actions/post_actions.jsx
parent742bab6429aeb1b581275da3c06af99fe293baab (diff)
parent30974533941e73f102505d07badf538cfdbbf3fc (diff)
downloadchat-92d8fa4aa8af170d0018baed94a8787d06297e44.tar.gz
chat-92d8fa4aa8af170d0018baed94a8787d06297e44.tar.bz2
chat-92d8fa4aa8af170d0018baed94a8787d06297e44.zip
Merge branch 'release-3.8'
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) {