From 86fbd496af8ff646bcff8484ad1733101333e8c6 Mon Sep 17 00:00:00 2001
From: Joram Wilander <jwawilander@gmail.com>
Date: Fri, 7 Apr 2017 14:21:31 -0400
Subject: Check if we need to add DM/GM to sidebar regardless of post sender
 (#6009)

---
 webapp/actions/post_actions.jsx | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'webapp/actions/post_actions.jsx')

diff --git a/webapp/actions/post_actions.jsx b/webapp/actions/post_actions.jsx
index 015d93d0f..3af99f9fa 100644
--- a/webapp/actions/post_actions.jsx
+++ b/webapp/actions/post_actions.jsx
@@ -20,19 +20,11 @@ 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 {
@@ -43,6 +35,14 @@ export function handleNewPost(post, msg) {
 
         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) {
-- 
cgit v1.2.3-1-g7c22

