MM-50123 : Identify causes of removal of channel and channel members re fetching on team switch (#22984)

This commit is contained in:
M-ZubairAhmed 2023-04-19 16:21:10 +05:30 committed by yasserfaraazkhan
parent 1bbfdefad7
commit bab2620b59
2 changed files with 10 additions and 28 deletions

View File

@ -254,25 +254,22 @@ export function fetchChannelsAndMembers(teamId: Team['id'] = ''): ActionFunc<{ch
teamId,
data: channels,
});
actions.push({
type: ChannelTypes.RECEIVED_MY_CHANNEL_MEMBERS,
data: channelMembers,
});
actions.push({
type: RoleTypes.RECEIVED_ROLES,
data: roles,
});
} else {
actions.push({
type: ChannelTypes.RECEIVED_ALL_CHANNELS,
data: channels,
});
actions.push({
type: ChannelTypes.RECEIVED_MY_CHANNEL_MEMBERS,
data: channelMembers,
});
}
actions.push({
type: ChannelTypes.RECEIVED_MY_CHANNEL_MEMBERS,
data: channelMembers,
});
actions.push({
type: RoleTypes.RECEIVED_ROLES,
data: roles,
});
await dispatch(batchActions(actions));
return {data: {channels, channelMembers, roles}};

View File

@ -4,10 +4,9 @@
import {ActionFunc} from 'mattermost-redux/types/actions';
import {getTeamByName, selectTeam} from 'mattermost-redux/actions/teams';
import {forceLogoutIfNecessary} from 'mattermost-redux/actions/helpers';
import {fetchMyChannelsAndMembersREST} from 'mattermost-redux/actions/channels';
import {getGroups, getAllGroupsAssociatedToChannelsInTeam, getAllGroupsAssociatedToTeam, getGroupsByUserIdPaginated} from 'mattermost-redux/actions/groups';
import {logError} from 'mattermost-redux/actions/errors';
import {isCustomGroupsEnabled, isGraphQLEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
import {getLicense} from 'mattermost-redux/selectors/entities/general';
@ -15,7 +14,6 @@ import {isSuccess} from 'types/actions';
import {loadStatusesForChannelAndSidebar} from 'actions/status_actions';
import {addUserToTeam} from 'actions/team_actions';
import {fetchChannelsAndMembers} from 'actions/channel_actions';
import LocalStorageStore from 'stores/local_storage_store';
@ -30,19 +28,6 @@ export function initializeTeam(team: Team): ActionFunc<Team, ServerError> {
const currentUser = getCurrentUser(state);
LocalStorageStore.setPreviousTeamId(currentUser.id, team.id);
const graphQLEnabled = isGraphQLEnabled(state);
try {
if (graphQLEnabled) {
await dispatch(fetchChannelsAndMembers(team.id));
} else {
await dispatch(fetchMyChannelsAndMembersREST(team.id));
}
} catch (error) {
forceLogoutIfNecessary(error as ServerError, dispatch, getState);
dispatch(logError(error as ServerError));
return {error: error as ServerError};
}
dispatch(loadStatusesForChannelAndSidebar());
const license = getLicense(state);