[MM-61361] Force reconnect handler to fetch channel categories on reconnect (#29010)

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2024-10-30 09:33:48 -04:00
коммит произвёл GitHub
родитель e55b018d5c
Коммит e8a80bd729
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@@ -237,6 +237,7 @@ export function reconnect() {
dispatch(loadChannelsForCurrentUser());
dispatch(fetchAllMyChannelMembers());
dispatch(fetchMyCategories(currentTeamId));
if (mostRecentPost) {
dispatch(syncPostsInChannel(currentChannelId, mostRecentPost.create_at));

Просмотреть файл

@@ -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', () => {