summaryrefslogtreecommitdiffstats
path: root/webapp/components/sidebar.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-03-23 13:03:12 -0400
committerHarrison Healey <harrisonmhealey@gmail.com>2016-03-23 13:03:12 -0400
commit1f46cca65ca0669c1fc1a6fec5113f835a1a3023 (patch)
tree5d2563bb88d8f71cbd8a50b921358378c04a2c5e /webapp/components/sidebar.jsx
parent6568e15023c009c96a46f022236f5fd4415445c0 (diff)
downloadchat-1f46cca65ca0669c1fc1a6fec5113f835a1a3023.tar.gz
chat-1f46cca65ca0669c1fc1a6fec5113f835a1a3023.tar.bz2
chat-1f46cca65ca0669c1fc1a6fec5113f835a1a3023.zip
Changed PreferenceStore to store data in memory
Diffstat (limited to 'webapp/components/sidebar.jsx')
-rw-r--r--webapp/components/sidebar.jsx15
1 files changed, 7 insertions, 8 deletions
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index 49ae1bec6..d8d825fd4 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -93,12 +93,12 @@ export default class Sidebar extends React.Component {
const preferences = PreferenceStore.getCategory(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW);
const directChannels = [];
- for (const preference of preferences) {
- if (preference.value !== 'true') {
+ for (const [name, value] of preferences) {
+ if (value !== 'true') {
continue;
}
- const teammateId = preference.name;
+ const teammateId = name;
let directChannel = channels.find(Utils.isDirectChannelForUser.bind(null, teammateId));
@@ -239,11 +239,10 @@ export default class Sidebar extends React.Component {
if (!this.isLeaving.get(channel.id)) {
this.isLeaving.set(channel.id, true);
- const preference = PreferenceStore.setPreference(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, channel.teammate_id, 'false');
-
- // bypass AsyncClient since we've already saved the updated preferences
- Client.savePreferences(
- [preference],
+ AsyncClient.savePreference(
+ Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW,
+ channel.teammate_id,
+ 'false',
() => {
this.isLeaving.set(channel.id, false);
},