summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-10-13 11:52:17 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-10-13 12:29:31 -0400
commit2a39e8dbfab8506b09d0d030f87cac4c079b975a (patch)
treedd2ca36ca7ef73a2cf8eda11d6a62848d7d29a79 /web/react/components
parent5cecf1afcd1d8e561a5b2d840e5bd1b588a74a27 (diff)
downloadchat-2a39e8dbfab8506b09d0d030f87cac4c079b975a.tar.gz
chat-2a39e8dbfab8506b09d0d030f87cac4c079b975a.tar.bz2
chat-2a39e8dbfab8506b09d0d030f87cac4c079b975a.zip
Removed Preference.AltId
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/more_direct_channels.jsx5
-rw-r--r--web/react/components/sidebar.jsx16
2 files changed, 9 insertions, 12 deletions
diff --git a/web/react/components/more_direct_channels.jsx b/web/react/components/more_direct_channels.jsx
index 0fbd90096..bc610cd60 100644
--- a/web/react/components/more_direct_channels.jsx
+++ b/web/react/components/more_direct_channels.jsx
@@ -23,9 +23,8 @@ export default class MoreDirectChannels extends React.Component {
}
handleJoinDirectChannel(channel) {
- const preference = PreferenceStore.setPreferenceWithAltId(Constants.Preferences.CATEGORY_DIRECT_CHANNELS,
- Constants.Preferences.NAME_SHOW, channel.teammate_id, 'true');
- AsyncClient.setPreferences([preference]);
+ const preference = PreferenceStore.setPreference(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, channel.teammate_id, 'true');
+ AsyncClient.savePreferences([preference]);
}
render() {
diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx
index 431f2ce1b..82fc828eb 100644
--- a/web/react/components/sidebar.jsx
+++ b/web/react/components/sidebar.jsx
@@ -54,7 +54,7 @@ export default class Sidebar extends React.Component {
teammates.push(teamMemberMap[id]);
}
- const preferences = PreferenceStore.getPreferences(Constants.Preferences.CATEGORY_DIRECT_CHANNELS, Constants.Preferences.NAME_SHOW);
+ const preferences = PreferenceStore.getPreferences(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW);
// Create lists of all read and unread direct channels
var visibleDirectChannels = [];
@@ -95,13 +95,12 @@ export default class Sidebar extends React.Component {
channel.teammate_id = teammate.id;
channel.status = UserStore.getStatus(teammate.id);
- if (preferences.some((preference) => (preference.alt_id === teammate.id && preference.value !== 'false'))) {
+ if (preferences.some((preference) => (preference.name === teammate.id && preference.value !== 'false'))) {
visibleDirectChannels.push(channel);
} else if (forceShow) {
// make sure that unread direct channels are visible
- const preference = PreferenceStore.setPreferenceWithAltId(Constants.Preferences.CATEGORY_DIRECT_CHANNELS,
- Constants.Preferences.NAME_SHOW, teammate.id, 'true');
- AsyncClient.setPreferences([preference]);
+ const preference = PreferenceStore.setPreference(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, teammate.id, 'true');
+ AsyncClient.savePreferences([preference]);
visibleDirectChannels.push(channel);
} else {
@@ -129,7 +128,7 @@ export default class Sidebar extends React.Component {
SocketStore.addChangeListener(this.onSocketChange);
PreferenceStore.addChangeListener(this.onChange);
- AsyncClient.getDirectChannels();
+ AsyncClient.getDirectChannelPreferences();
$('.nav-pills__container').perfectScrollbar();
@@ -310,9 +309,8 @@ export default class Sidebar extends React.Component {
if (!this.isLeaving.get(channel.id)) {
this.isLeaving.set(channel.id, true);
- const preference = PreferenceStore.setPreferenceWithAltId(Constants.Preferences.CATEGORY_DIRECT_CHANNELS,
- Constants.Preferences.NAME_SHOW, channel.teammate_id, 'false');
- AsyncClient.setPreferences(
+ const preference = PreferenceStore.setPreference(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, channel.teammate_id, 'false');
+ AsyncClient.savePreferences(
[preference],
() => {
this.isLeaving.set(channel.id, false);