diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/more_direct_channels.jsx | 4 | ||||
-rw-r--r-- | web/react/components/sidebar.jsx | 8 | ||||
-rw-r--r-- | web/react/utils/async_client.jsx | 4 | ||||
-rw-r--r-- | web/react/utils/constants.jsx | 6 |
4 files changed, 15 insertions, 7 deletions
diff --git a/web/react/components/more_direct_channels.jsx b/web/react/components/more_direct_channels.jsx index fc720e928..ed9c6fc58 100644 --- a/web/react/components/more_direct_channels.jsx +++ b/web/react/components/more_direct_channels.jsx @@ -3,6 +3,7 @@ var TeamStore = require('../stores/team_store.jsx'); var Client = require('../utils/client.jsx'); +var Constants = require('../utils/constants.jsx'); var AsyncClient = require('../utils/async_client.jsx'); var PreferenceStore = require('../stores/preference_store.jsx'); var utils = require('../utils/utils.jsx'); @@ -23,7 +24,8 @@ export default class MoreDirectChannels extends React.Component { } handleJoinDirectChannel(channel) { - const preference = PreferenceStore.setPreferenceWithAltId('direct_channels', 'show_hide', channel.teammate_id, 'true'); + const preference = PreferenceStore.setPreferenceWithAltId(Constants.Preferences.CATEGORY_DIRECT_CHANNELS, + Constants.Preferences.NAME_SHOW, channel.teammate_id, 'true'); AsyncClient.setPreferences([preference]); } diff --git a/web/react/components/sidebar.jsx b/web/react/components/sidebar.jsx index de353deb4..97f705f32 100644 --- a/web/react/components/sidebar.jsx +++ b/web/react/components/sidebar.jsx @@ -52,7 +52,7 @@ export default class Sidebar extends React.Component { teammates.push(teamMemberMap[id]); } - const preferences = PreferenceStore.getPreferences('direct_channels', 'show_hide'); + const preferences = PreferenceStore.getPreferences(Constants.Preferences.CATEGORY_DIRECT_CHANNELS, Constants.Preferences.NAME_SHOW); // Create lists of all read and unread direct channels var visibleDirectChannels = []; @@ -96,7 +96,8 @@ export default class Sidebar extends React.Component { visibleDirectChannels.push(channel); } else if (forceShow) { // make sure that unread direct channels are visible - const preference = PreferenceStore.setPreferenceWithAltId('direct_channels', 'show_hide', teammate.id, 'true'); + const preference = PreferenceStore.setPreferenceWithAltId(Constants.Preferences.CATEGORY_DIRECT_CHANNELS, + Constants.Preferences.NAME_SHOW, teammate.id, 'true'); AsyncClient.setPreferences([preference]); visibleDirectChannels.push(channel); @@ -306,7 +307,8 @@ export default class Sidebar extends React.Component { if (!channel.leaving) { channel.leaving = true; - const preference = PreferenceStore.setPreferenceWithAltId('direct_channels', 'show_hide', channel.teammate_id, 'false'); + const preference = PreferenceStore.setPreferenceWithAltId(Constants.Preferences.CATEGORY_DIRECT_CHANNELS, + Constants.Preferences.NAME_SHOW, channel.teammate_id, 'false'); AsyncClient.setPreferences( [preference], () => { 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; diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 56c47a244..a576b9098 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -286,5 +286,9 @@ module.exports = { id: 'mentionHighlightLink', uiName: 'Mention Highlight Link' } - ] + ], + Preferences: { + CATEGORY_DIRECT_CHANNELS: 'direct_channels', + NAME_SHOW: 'show' + } }; |