Commit 3afc9a51 authored by Shubham Varshney's avatar Shubham Varshney Committed by sudheer
Browse files

Added Direct Channels in the channels list of goToLastViewedChannel (#5903)


Co-authored-by: default avatarvars07 <shubham.varshney@nutanix.com>
parent d5d1353e
......@@ -22,6 +22,7 @@ import {
getRedirectChannelNameForTeam,
getMyChannels,
getMyChannelMemberships,
getAllDirectChannelsNameMapInCurrentTeam,
isFavoriteChannel,
isManuallyUnread,
} from 'mattermost-redux/selectors/entities/channels';
......@@ -57,11 +58,13 @@ export function goToLastViewedChannel() {
const state = getState();
const currentChannel = getCurrentChannel(state);
const channelsInTeam = getChannelsNameMapInCurrentTeam(state);
const directChannel = getAllDirectChannelsNameMapInCurrentTeam(state);
const channels = Object.assign({}, channelsInTeam, directChannel);
let channelToSwitchTo = getChannelByName(channelsInTeam, getLastViewedChannelName(state));
let channelToSwitchTo = getChannelByName(channels, getLastViewedChannelName(state));
if (currentChannel.id === channelToSwitchTo.id) {
channelToSwitchTo = getChannelByName(channelsInTeam, getRedirectChannelNameForTeam(state, getCurrentTeamId(state)));
channelToSwitchTo = getChannelByName(channels, getRedirectChannelNameForTeam(state, getCurrentTeamId(state)));
}
return dispatch(switchToChannel(channelToSwitchTo));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment