From 7d03c24b44a2f4eba86adf86954280fa73e726e4 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Fri, 2 Oct 2015 09:50:34 -0400
Subject: Changed direct channels in the sidebar to be displayed based on user
 preferences

---
 web/react/utils/async_client.jsx | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

(limited to 'web/react/utils/async_client.jsx')

diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index a903f055b..3f084578a 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -637,3 +637,32 @@ export function getMyTeam() {
         }
     );
 }
+
+export function getDirectChannels() {
+    if (isCallInProgress('getDirectChannels')) {
+        return;
+    }
+
+    callTracker.getDirectChannels = utils.getTimestamp();
+    client.getPreferencesByName(
+        'direct_channels',
+        'show_hide',
+        (data, textStatus, xhr) => {
+            callTracker.getDirectChannels = 0;
+
+            if (xhr.status === 304 || !data) {
+                return;
+            }
+
+            AppDispatcher.handleServerAction({
+                type: ActionTypes.RECIEVED_PREFERENCES,
+                preferences: data
+            });
+        },
+        (err) => {
+            callTracker.getDirectChannels = 0;
+            dispatchError(err, 'getDirectChannels');
+        }
+    );
+}
+
-- 
cgit v1.2.3-1-g7c22


From ed31538893ad2790de46ace7eeac5c1aa015a7f1 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Fri, 2 Oct 2015 14:25:55 -0400
Subject: Changed direct messages channels so users can show/hide them

---
 web/react/utils/async_client.jsx | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

(limited to 'web/react/utils/async_client.jsx')

diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 3f084578a..d665dfc94 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -666,3 +666,27 @@ export function getDirectChannels() {
     );
 }
 
+export function setPreferences(preferences, success, error) {
+    client.setPreferences(
+        preferences,
+        (data, textStatus, xhr) => {
+            if (xhr.status !== 304) {
+                AppDispatcher.handleServerAction({
+                    type: ActionTypes.RECIEVED_PREFERENCES,
+                    preferences
+                });
+            }
+
+            if (success) {
+                success(data);
+            }
+        },
+        (err) => {
+            dispatchError(err, 'setPreferences');
+
+            if (error) {
+                error();
+            }
+        }
+    );
+}
-- 
cgit v1.2.3-1-g7c22


From 599644fb2fa75d1760420806c8c821959fc6b645 Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Mon, 5 Oct 2015 12:03:27 -0400
Subject: Renamed show_hide preference to show

---
 web/react/utils/async_client.jsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'web/react/utils/async_client.jsx')

diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index d665dfc94..a0ccccd88 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -645,8 +645,8 @@ export function getDirectChannels() {
 
     callTracker.getDirectChannels = utils.getTimestamp();
     client.getPreferencesByName(
-        'direct_channels',
-        'show_hide',
+        Constants.Preferences.CATEGORY_DIRECT_CHANNELS,
+        Constants.Preferences.NAME_SHOW,
         (data, textStatus, xhr) => {
             callTracker.getDirectChannels = 0;
 
-- 
cgit v1.2.3-1-g7c22


From 2a39e8dbfab8506b09d0d030f87cac4c079b975a Mon Sep 17 00:00:00 2001
From: hmhealey <harrisonmhealey@gmail.com>
Date: Tue, 13 Oct 2015 11:52:17 -0400
Subject: Removed Preference.AltId

---
 web/react/utils/async_client.jsx | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

(limited to 'web/react/utils/async_client.jsx')

diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index a0ccccd88..1bf8a6fee 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -638,17 +638,16 @@ export function getMyTeam() {
     );
 }
 
-export function getDirectChannels() {
-    if (isCallInProgress('getDirectChannels')) {
+export function getDirectChannelPreferences() {
+    if (isCallInProgress('getDirectChannelPreferences')) {
         return;
     }
 
-    callTracker.getDirectChannels = utils.getTimestamp();
-    client.getPreferencesByName(
-        Constants.Preferences.CATEGORY_DIRECT_CHANNELS,
-        Constants.Preferences.NAME_SHOW,
+    callTracker.getDirectChannelPreferences = utils.getTimestamp();
+    client.getPreferenceCategory(
+        Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,
         (data, textStatus, xhr) => {
-            callTracker.getDirectChannels = 0;
+            callTracker.getDirectChannelPreferences = 0;
 
             if (xhr.status === 304 || !data) {
                 return;
@@ -660,14 +659,14 @@ export function getDirectChannels() {
             });
         },
         (err) => {
-            callTracker.getDirectChannels = 0;
-            dispatchError(err, 'getDirectChannels');
+            callTracker.getDirectChannelPreferences = 0;
+            dispatchError(err, 'getDirectChannelPreferences');
         }
     );
 }
 
-export function setPreferences(preferences, success, error) {
-    client.setPreferences(
+export function savePreferences(preferences, success, error) {
+    client.savePreferences(
         preferences,
         (data, textStatus, xhr) => {
             if (xhr.status !== 304) {
@@ -682,7 +681,7 @@ export function setPreferences(preferences, success, error) {
             }
         },
         (err) => {
-            dispatchError(err, 'setPreferences');
+            dispatchError(err, 'savePreferences');
 
             if (error) {
                 error();
-- 
cgit v1.2.3-1-g7c22

