Fix show channels that you are a member of and Fixed removal of the member when leaving the channel (#174)

This commit is contained in:
enahum 2017-01-23 12:09:23 -03:00 committed by Harrison Healey
parent 33d8eef991
commit bc63b9e8bb
2 changed files with 7 additions and 2 deletions

View file

@ -266,6 +266,10 @@ function handleUserRemovedEvent(msg, dispatch, getState) {
if (msg.broadcast.user_id === users.currentId && teamId) {
fetchMyChannelsAndMembers(teamId)(dispatch, getState);
dispatch({
type: ChannelTypes.LEAVE_CHANNEL,
data: msg.data.channel_id
}, getState);
} else if (msg.broadcast.channel_id === channels.currentId) {
getChannelStats(teamId, channels.currentId)(dispatch, getState);
}

View file

@ -52,15 +52,16 @@ export const getChannelsOnCurrentTeam = createSelector(
export const getChannelsByCategory = createSelector(
getCurrentChannelId,
getChannelsOnCurrentTeam,
(state) => state.entities.channels.myMembers,
(state) => state.entities.users,
(state) => state.entities.preferences.myPreferences,
(state) => state.entities.teams,
(currentChannelId, channels, usersState, myPreferences, teamsState) => {
(currentChannelId, channels, myMembers, usersState, myPreferences, teamsState) => {
const allChannels = channels.map((c) => {
const channel = {...c};
channel.isCurrent = c.id === currentChannelId;
return channel;
});
}).filter((c) => myMembers.hasOwnProperty(c.id));
return buildDisplayableChannelList(usersState, teamsState, allChannels, myPreferences);
}