File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
apps/meteor/client/views/root/MainLayout Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ const LayoutWithSidebar = ({ children }: { children: ReactNode }): ReactElement
1616 const removeSidenav = embeddedLayout && ! currentRoutePath ?. startsWith ( '/admin' ) ;
1717
1818 const firstChannelAfterLogin = useSetting < string > ( 'First_Channel_After_Login' , '' ) ;
19- const roomName = firstChannelAfterLogin . startsWith ( '#' ) ? firstChannelAfterLogin . slice ( 1 ) : firstChannelAfterLogin ;
19+ const roomName = ( firstChannelAfterLogin . startsWith ( '#' ) ? firstChannelAfterLogin . slice ( 1 ) : firstChannelAfterLogin ) . trim ( ) ;
2020
2121 const redirected = useRef ( false ) ;
2222
@@ -31,6 +31,11 @@ const LayoutWithSidebar = ({ children }: { children: ReactNode }): ReactElement
3131 return ;
3232 }
3333
34+ if ( roomName . startsWith ( '@' ) || roomName . startsWith ( '?' ) ) {
35+ // Because this will break url routing. Eg: /channel/#roomName and /channel/?roomName which will route to path /channel
36+ return ;
37+ }
38+
3439 if ( redirected . current ) {
3540 return ;
3641 }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const LayoutWithSidebarV2 = ({ children }: { children: ReactNode }): ReactElemen
2121 const removeSidenav = embeddedLayout && ! currentRoutePath ?. startsWith ( '/admin' ) ;
2222
2323 const firstChannelAfterLogin = useSetting < string > ( 'First_Channel_After_Login' , '' ) ;
24- const roomName = firstChannelAfterLogin . startsWith ( '#' ) ? firstChannelAfterLogin . slice ( 1 ) : firstChannelAfterLogin ;
24+ const roomName = ( firstChannelAfterLogin . startsWith ( '#' ) ? firstChannelAfterLogin . slice ( 1 ) : firstChannelAfterLogin ) . trim ( ) ;
2525
2626 const redirected = useRef ( false ) ;
2727
@@ -36,6 +36,11 @@ const LayoutWithSidebarV2 = ({ children }: { children: ReactNode }): ReactElemen
3636 return ;
3737 }
3838
39+ if ( roomName . startsWith ( '@' ) || roomName . startsWith ( '?' ) ) {
40+ // Because this will break url routing. Eg: /channel/#roomName and /channel/?roomName which will route to path /channel
41+ return ;
42+ }
43+
3944 if ( redirected . current ) {
4045 return ;
4146 }
You can’t perform that action at this time.
0 commit comments