From 4b51490a3836144e6407b71cbd00aa094985168a Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 7 Dec 2015 18:14:07 -0500
Subject: Moved logic for making direct channels visible to both members on
 post to the server

---
 web/react/components/sidebar.jsx | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

(limited to 'web/react/components/sidebar.jsx')

diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 3d7f449d1..b9835ae11 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -89,25 +89,14 @@ export default class Sidebar extends React.Component {
                 continue;
             }
 
-            const member = members[dm.id];
-            const msgCount = dm.total_msg_count - member.msg_count;
+            const show = preferences.some((preference) => (preference.name === teammate.id && preference.value !== 'false'));
 
-            // always show a channel if either it is the current one or if it is unread, but it is not currently being left
-            const forceShow = (currentChannelId === dm.id || msgCount > 0) && !this.isLeaving.get(dm.id);
-            const preferenceShow = preferences.some((preference) => (preference.name === teammate.id && preference.value !== 'false'));
-
-            if (preferenceShow || forceShow) {
+            if (show) {
                 dm.display_name = Utils.displayUsername(teammate.id);
                 dm.teammate_id = teammate.id;
                 dm.status = UserStore.getStatus(teammate.id);
 
                 visibleDirectChannels.push(dm);
-
-                if (forceShow && !preferenceShow) {
-                    // make sure that unread direct channels are visible
-                    const preference = PreferenceStore.setPreference(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, teammate.id, 'true');
-                    AsyncClient.savePreferences([preference]);
-                }
             }
         }
 
-- 
cgit v1.2.3-1-g7c22

