From 55f3ae576d47245dcc8393b0ffbefb38eba65645 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 30 Mar 2016 09:55:32 -0400 Subject: [PATCH 1/2] Fixed adding direct channels to the sidebar --- webapp/utils/utils.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx index 83519a6ec5..99765cae2a 100644 --- a/webapp/utils/utils.jsx +++ b/webapp/utils/utils.jsx @@ -1255,12 +1255,15 @@ export function windowHeight() { } export function openDirectChannelToUser(user, successCb, errorCb) { + AsyncClient.savePreference( + Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, + user.id, + 'true' + ); + const channelName = this.getDirectChannelName(UserStore.getCurrentId(), user.id); let channel = ChannelStore.getByName(channelName); - const preference = PreferenceStore.setPreference(Constants.Preferences.CATEGORY_DIRECT_CHANNEL_SHOW, user.id, 'true'); - AsyncClient.savePreferences([preference]); - if (channel) { if ($.isFunction(successCb)) { successCb(channel, true); From b6d6153afb07bc18ef162d063c0a413f80a59f52 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 30 Mar 2016 10:14:34 -0400 Subject: [PATCH 2/2] Fixed leaving a direct channel so that it doesn't open the channel you just left --- webapp/components/sidebar.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index 45bca72129..b22d3ec343 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -238,7 +238,9 @@ export default class Sidebar extends React.Component { }); } - handleLeaveDirectChannel(channel) { + handleLeaveDirectChannel(e, channel) { + e.preventDefault(); + if (!this.isLeaving.get(channel.id)) { this.isLeaving.set(channel.id, true); @@ -258,7 +260,7 @@ export default class Sidebar extends React.Component { } if (channel.id === this.state.activeId) { - browserHistory.push(TeamStore.getCurrentTeamUrl() + '/channels/town-square'); + browserHistory.push('/' + this.state.currentTeam.name + '/channels/town-square'); } } @@ -422,7 +424,7 @@ export default class Sidebar extends React.Component { overlay={removeTooltip} > handleClose(channel)} + onClick={(e) => handleClose(e, channel)} className='btn-close' > {'×'}