diff --git a/webapp/channels/src/actions/websocket_actions.jsx b/webapp/channels/src/actions/websocket_actions.jsx index 1d429433e2..85d0f921bc 100644 --- a/webapp/channels/src/actions/websocket_actions.jsx +++ b/webapp/channels/src/actions/websocket_actions.jsx @@ -33,6 +33,7 @@ import { markMultipleChannelsAsRead, getChannelMemberCountsByGroup, fetchAllMyChannelMembers, + fetchAllMyTeamsChannels, } from 'mattermost-redux/actions/channels'; import {getCloudSubscription} from 'mattermost-redux/actions/cloud'; import {clearErrors, logError} from 'mattermost-redux/actions/errors'; @@ -106,7 +107,7 @@ import {sendDesktopNotification} from 'actions/notification_actions'; import {handleNewPost} from 'actions/post_actions'; import * as StatusActions from 'actions/status_actions'; import {setGlobalItem} from 'actions/storage'; -import {loadProfilesForDM, loadProfilesForGM} from 'actions/user_actions'; +import {loadProfilesForDM, loadProfilesForGM, loadProfilesForSidebar} from 'actions/user_actions'; import {syncPostsInChannel} from 'actions/views/channel'; import {setGlobalDraft, transformServerDraft} from 'actions/views/drafts'; import {openModal} from 'actions/views/modals'; @@ -237,9 +238,10 @@ export function reconnect() { dispatch(handleRefreshAppsBindings()); } - dispatch(loadChannelsForCurrentUser()); + dispatch(fetchAllMyTeamsChannels()); dispatch(fetchAllMyChannelMembers()); dispatch(fetchMyCategories(currentTeamId)); + dispatch(loadProfilesForSidebar()); if (mostRecentPost) { dispatch(syncPostsInChannel(currentChannelId, mostRecentPost.create_at)); diff --git a/webapp/channels/src/actions/websocket_actions.test.jsx b/webapp/channels/src/actions/websocket_actions.test.jsx index ee8a89f865..3f5cd04e8c 100644 --- a/webapp/channels/src/actions/websocket_actions.test.jsx +++ b/webapp/channels/src/actions/websocket_actions.test.jsx @@ -3,6 +3,7 @@ import {CloudTypes} from 'mattermost-redux/action_types'; import {fetchMyCategories} from 'mattermost-redux/actions/channel_categories'; +import {fetchAllMyTeamsChannels} from 'mattermost-redux/actions/channels'; import {getGroup} from 'mattermost-redux/actions/groups'; import { getPostThreads, @@ -72,6 +73,7 @@ jest.mock('mattermost-redux/actions/users', () => ({ jest.mock('mattermost-redux/actions/channels', () => ({ getChannelStats: jest.fn(() => ({type: 'GET_CHANNEL_STATS'})), fetchAllMyChannelMembers: jest.fn(() => ({type: 'FETCH_ALL_MY_CHANNEL_MEMBERS'})), + fetchAllMyTeamsChannels: jest.fn(), })); jest.mock('actions/post_actions', () => ({ @@ -79,6 +81,11 @@ jest.mock('actions/post_actions', () => ({ handleNewPost: jest.fn(() => ({type: 'HANDLE_NEW_POST'})), })); +jest.mock('actions/user_actions', () => ({ + ...jest.requireActual('actions/user_actions'), + loadProfilesForSidebar: jest.fn(), +})); + jest.mock('actions/global_actions', () => ({ ...jest.requireActual('actions/global_actions'), redirectUserToDefaultTeam: jest.fn(), @@ -652,6 +659,11 @@ describe('reconnect', () => { reconnect(); expect(fetchMyCategories).toHaveBeenCalledWith('currentTeamId'); }); + + test('should call fetchAllMyTeamsChannels when socket reconnects', () => { + reconnect(); + expect(fetchAllMyTeamsChannels).toHaveBeenCalled(); + }); }); describe('handleChannelUpdatedEvent', () => {