Revert "MM-50123 : Identify causes of removal of channel and channel members re fetching on team switch (#22984)" (#23038)
This reverts commit 5d5c1d90bf.
Этот коммит содержится в:
коммит произвёл
yasserfaraazkhan
родитель
7c60637cab
Коммит
1f697ba5cd
@@ -254,22 +254,25 @@ export function fetchChannelsAndMembers(teamId: Team['id'] = ''): ActionFunc<{ch
|
|||||||
teamId,
|
teamId,
|
||||||
data: channels,
|
data: channels,
|
||||||
});
|
});
|
||||||
|
actions.push({
|
||||||
|
type: ChannelTypes.RECEIVED_MY_CHANNEL_MEMBERS,
|
||||||
|
data: channelMembers,
|
||||||
|
});
|
||||||
|
actions.push({
|
||||||
|
type: RoleTypes.RECEIVED_ROLES,
|
||||||
|
data: roles,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
actions.push({
|
actions.push({
|
||||||
type: ChannelTypes.RECEIVED_ALL_CHANNELS,
|
type: ChannelTypes.RECEIVED_ALL_CHANNELS,
|
||||||
data: 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));
|
await dispatch(batchActions(actions));
|
||||||
|
|
||||||
return {data: {channels, channelMembers, roles}};
|
return {data: {channels, channelMembers, roles}};
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
import {ActionFunc} from 'mattermost-redux/types/actions';
|
import {ActionFunc} from 'mattermost-redux/types/actions';
|
||||||
import {getTeamByName, selectTeam} from 'mattermost-redux/actions/teams';
|
import {getTeamByName, selectTeam} from 'mattermost-redux/actions/teams';
|
||||||
import {forceLogoutIfNecessary} from 'mattermost-redux/actions/helpers';
|
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 {getGroups, getAllGroupsAssociatedToChannelsInTeam, getAllGroupsAssociatedToTeam, getGroupsByUserIdPaginated} from 'mattermost-redux/actions/groups';
|
||||||
import {logError} from 'mattermost-redux/actions/errors';
|
import {logError} from 'mattermost-redux/actions/errors';
|
||||||
import {isCustomGroupsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
import {isCustomGroupsEnabled, isGraphQLEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||||
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
import {getCurrentUser} from 'mattermost-redux/selectors/entities/users';
|
||||||
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
import {getLicense} from 'mattermost-redux/selectors/entities/general';
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ import {isSuccess} from 'types/actions';
|
|||||||
|
|
||||||
import {loadStatusesForChannelAndSidebar} from 'actions/status_actions';
|
import {loadStatusesForChannelAndSidebar} from 'actions/status_actions';
|
||||||
import {addUserToTeam} from 'actions/team_actions';
|
import {addUserToTeam} from 'actions/team_actions';
|
||||||
|
import {fetchChannelsAndMembers} from 'actions/channel_actions';
|
||||||
|
|
||||||
import LocalStorageStore from 'stores/local_storage_store';
|
import LocalStorageStore from 'stores/local_storage_store';
|
||||||
|
|
||||||
@@ -28,6 +30,19 @@ export function initializeTeam(team: Team): ActionFunc<Team, ServerError> {
|
|||||||
const currentUser = getCurrentUser(state);
|
const currentUser = getCurrentUser(state);
|
||||||
LocalStorageStore.setPreviousTeamId(currentUser.id, team.id);
|
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());
|
dispatch(loadStatusesForChannelAndSidebar());
|
||||||
|
|
||||||
const license = getLicense(state);
|
const license = getLicense(state);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user