mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-50123 : Identify causes of removal of channel and channel members re fetching on team switch (#22984)
This commit is contained in:
parent
1bbfdefad7
commit
bab2620b59
@ -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}};
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user