MM-12960: Only back to previous channel if is not archived (#2389)

This commit is contained in:
Jesús Espino 2018-11-28 16:31:48 +01:00 committed by Harrison Healey
parent 92db348c09
commit 4148ee93e5

View file

@ -20,7 +20,6 @@ import {getProfilesInChannel} from 'mattermost-redux/actions/users';
import {General, Preferences} from 'mattermost-redux/constants';
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
import {getTeamByName} from 'mattermost-redux/selectors/entities/teams';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {
getChannelByName,
@ -283,7 +282,6 @@ export function selectPenultimateChannel(teamId) {
const {channels, myMembers} = state.entities.channels;
const {currentUserId} = state.entities.users;
const {myPreferences} = state.entities.preferences;
const viewArchivedChannels = getConfig(state).ExperimentalViewArchivedChannels === 'true';
const lastChannelForTeam = state.views.team.lastChannelForTeam[teamId];
const lastChannelId = lastChannelForTeam && lastChannelForTeam.length > 1 ? lastChannelForTeam[1] : '';
const lastChannel = channels[lastChannelId];
@ -297,7 +295,7 @@ export function selectPenultimateChannel(teamId) {
if (
myMembers[lastChannelId] &&
lastChannel &&
(lastChannel.delete_at === 0 || viewArchivedChannels) &&
lastChannel.delete_at === 0 &&
(lastChannel.team_id === teamId || isDMVisible || isGMVisible)
) {
dispatch(setChannelLoading(true));