Skip to content

Commit

Permalink
Merge branch 'rm/362272' into 'master'
Browse files Browse the repository at this point in the history
redirect in general only if unauthorized actions in ws reconnect

See merge request kchat/webapp!935
  • Loading branch information
antonbuks committed Oct 3, 2024
2 parents c601b19 + 17c6026 commit 928d230
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions webapp/channels/src/actions/channel_actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.

import type {ClientError} from '@infomaniak/mattermost-client';
import {batchActions} from 'redux-batched-actions';

import type {Channel} from '@mattermost/types/channels';
Expand All @@ -16,7 +17,7 @@ import {getMyChannelMemberships} from 'mattermost-redux/selectors/entities/commo
import {getPost} from 'mattermost-redux/selectors/entities/posts';
import {getCurrentTeamUrl, getCurrentTeamId, getCurrentRelativeTeamUrl} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
import type {ActionFuncAsync} from 'mattermost-redux/types/actions';
import type {ActionFuncAsync, ActionResult} from 'mattermost-redux/types/actions';

import {trackEvent} from 'actions/telemetry_actions.jsx';
import {loadNewDMIfNeeded, loadNewGMIfNeeded, loadProfilesForSidebar} from 'actions/user_actions';
Expand Down Expand Up @@ -102,9 +103,10 @@ export function loadDeletedPosts(channelId: string, lastDisconnectAt: number): A
return async (dispatch, getState) => {
const state = getState();

const results = await dispatch(fetchDeletedPostsIds(channelId, lastDisconnectAt));
const results = await dispatch(fetchDeletedPostsIds(channelId, lastDisconnectAt)) as ActionResult<string[] | null, ClientError>;
const error = results.error;

if ('error' in results) {
if (error && error.status_code === 403) {
const currentTeamId = getCurrentTeamId(state);
const redirectChannel = getRedirectChannelNameForTeam(state, currentTeamId);
const teamUrl = getCurrentRelativeTeamUrl(state);
Expand Down

0 comments on commit 928d230

Please sign in to comment.