From f62634622f5f9ecb8aa60d009d2629344a15dceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 19 Oct 2023 12:59:02 +0200 Subject: [PATCH] [MM-53904] Fix MM-53904 (#24622) * Fix MM-53904 * Simplify regex * Simplify utils regex * Fix lint * Address feedback and polish regex --------- Co-authored-by: Mattermost Build --- .../center_channel/center_channel.tsx | 12 +++++++----- .../root/__snapshots__/root.test.tsx.snap | 2 +- webapp/channels/src/components/root/root.tsx | 5 +++-- .../team_controller/team_controller.tsx | 7 ++++--- webapp/channels/src/utils/path.ts | 19 +++++++++++++++++++ webapp/channels/src/utils/utils.tsx | 4 ++-- 6 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 webapp/channels/src/utils/path.ts diff --git a/webapp/channels/src/components/channel_layout/center_channel/center_channel.tsx b/webapp/channels/src/components/channel_layout/center_channel/center_channel.tsx index d9879b92ec..e7fdf573d9 100644 --- a/webapp/channels/src/components/channel_layout/center_channel/center_channel.tsx +++ b/webapp/channels/src/components/channel_layout/center_channel/center_channel.tsx @@ -11,6 +11,8 @@ import PlaybookRunner from 'components/channel_layout/playbook_runner'; import LoadingScreen from 'components/loading_screen'; import PermalinkView from 'components/permalink_view'; +import {IDENTIFIER_PATH_PATTERN, ID_PATH_PATTERN, TEAM_NAME_PATH_PATTERN} from 'utils/path'; + import type {OwnProps, PropsFromRedux} from './index'; const LazyChannelHeaderMobile = makeAsyncComponent( @@ -92,7 +94,7 @@ export default class CenterChannel extends React.PureComponent {
( { )} /> {isCollapsedThreadsEnabled ? ( ) : null} diff --git a/webapp/channels/src/components/root/__snapshots__/root.test.tsx.snap b/webapp/channels/src/components/root/__snapshots__/root.test.tsx.snap index 63fca055e8..c95df50d77 100644 --- a/webapp/channels/src/components/root/__snapshots__/root.test.tsx.snap +++ b/webapp/channels/src/components/root/__snapshots__/root.test.tsx.snap @@ -117,7 +117,7 @@ exports[`components/Root Routes Should mount public product routes 1`] = ` /> diff --git a/webapp/channels/src/components/root/root.tsx b/webapp/channels/src/components/root/root.tsx index a7c7a6fc7c..c8987f286e 100644 --- a/webapp/channels/src/components/root/root.tsx +++ b/webapp/channels/src/components/root/root.tsx @@ -55,6 +55,7 @@ import Pluggable from 'plugins/pluggable'; import A11yController from 'utils/a11y_controller'; import {PageLoadContext, StoragePrefixes} from 'utils/constants'; import {EmojiIndicesByAlias} from 'utils/emoji'; +import {TEAM_NAME_PATH_PATTERN} from 'utils/path'; import {getSiteURL} from 'utils/url'; import * as UserAgent from 'utils/user_agent'; import * as Utils from 'utils/utils'; @@ -111,7 +112,7 @@ const OnBoardingTaskList = makeAsyncComponent('OnboardingTaskList', LazyOnBoardi type LoggedInRouteProps = { component: React.ComponentType; - path: string; + path: string | string[]; theme?: Theme; // the routes that send the theme are the ones that will actually need to show the onboarding tasklist }; function LoggedInRoute(props: LoggedInRouteProps) { @@ -644,7 +645,7 @@ export default class Root extends React.PureComponent { ))} diff --git a/webapp/channels/src/components/team_controller/team_controller.tsx b/webapp/channels/src/components/team_controller/team_controller.tsx index 3342b55317..4cfc0a0601 100644 --- a/webapp/channels/src/components/team_controller/team_controller.tsx +++ b/webapp/channels/src/components/team_controller/team_controller.tsx @@ -19,6 +19,7 @@ import useTelemetryIdentitySync from 'components/common/hooks/useTelemetryIdenti import Constants from 'utils/constants'; import {cmdOrCtrlPressed, isKeyPressed} from 'utils/keyboard'; +import {TEAM_NAME_PATH_PATTERN} from 'utils/path'; import {isIosSafari} from 'utils/user_agent'; import type {OwnProps, PropsFromRedux} from './index'; @@ -208,17 +209,17 @@ function TeamController(props: Props) { return ( {props.plugins?.map((plugin) => ( (