Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
PLT-6432 Channel preferences are restored when closing a DM/GM channe…
Browse files Browse the repository at this point in the history
…l and then re-opening later (#180)

* Closing and reopening a favorite DM or GM channel restores it under favorite channels

* Including public and private channels under favorite channels
  • Loading branch information
santos22 authored and hmhealey committed Nov 7, 2017
1 parent f80656d commit 94632b0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions components/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,6 @@ export default class Sidebar extends React.Component {
}
);

if (ChannelUtils.isFavoriteChannel(channel)) {
ChannelActions.unmarkFavorite(channel.id);
}

this.setState(this.getStateFromStores());
trackEvent('ui', 'ui_direct_channel_x_button_clicked');
}
Expand Down Expand Up @@ -738,7 +734,12 @@ export default class Sidebar extends React.Component {
this.lastUnreadChannel = null;

// create elements for all 4 types of channels
const favoriteItems = this.state.favoriteChannels.
const visibleFavoriteChannels = this.state.favoriteChannels.
filter((channel) => {
return ChannelUtils.isOpenChannel(channel) || ChannelUtils.isPrivateChannel(channel) || ChannelUtils.isDirectChannelVisible(channel) || ChannelUtils.isGroupChannelVisible(channel);
});

const favoriteItems = visibleFavoriteChannels.
map((channel, index, arr) => {
if (channel.type === Constants.DM_CHANNEL || channel.type === Constants.GM_CHANNEL) {
return this.createChannelElement(channel, index, arr, this.handleLeaveDirectChannel);
Expand Down

0 comments on commit 94632b0

Please sign in to comment.