diff --git a/webapp/channels/src/actions/websocket_actions.jsx b/webapp/channels/src/actions/websocket_actions.jsx index 566ff74a47..3ef7532ea7 100644 --- a/webapp/channels/src/actions/websocket_actions.jsx +++ b/webapp/channels/src/actions/websocket_actions.jsx @@ -237,6 +237,7 @@ export function reconnect() { dispatch(loadChannelsForCurrentUser()); dispatch(fetchAllMyChannelMembers()); + dispatch(fetchMyCategories(currentTeamId)); 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 78ca412a07..8f1bd5b0ee 100644 --- a/webapp/channels/src/actions/websocket_actions.test.jsx +++ b/webapp/channels/src/actions/websocket_actions.test.jsx @@ -2,6 +2,7 @@ // See LICENSE.txt for license information. import {UserTypes, CloudTypes} from 'mattermost-redux/action_types'; +import {fetchMyCategories} from 'mattermost-redux/actions/channel_categories'; import {getGroup} from 'mattermost-redux/actions/groups'; import { getPostThreads, @@ -44,6 +45,11 @@ jest.mock('mattermost-redux/actions/posts', () => ({ getMentionsAndStatusesForPosts: jest.fn(), })); +jest.mock('mattermost-redux/actions/channel_categories', () => ({ + ...jest.requireActual('mattermost-redux/actions/channel_categories'), + fetchMyCategories: jest.fn(), +})); + jest.mock('mattermost-redux/actions/status_profile_polling', () => ({ ...jest.requireActual('mattermost-redux/actions/status_profile_polling'), batchFetchStatusesProfilesGroupsFromPosts: jest.fn(() => ({type: ''})), @@ -637,6 +643,11 @@ describe('reconnect', () => { reconnect(); expect(syncPostsInChannel).toHaveBeenCalledWith('otherChannel', '12345'); }); + + test('should call fetchMyCategories when socket reconnects', () => { + reconnect(); + expect(fetchMyCategories).toHaveBeenCalledWith('currentTeamId'); + }); }); describe('handleChannelUpdatedEvent', () => {