Skip to content

Commit 3ecc79d

Browse files
committed
improvements
Signed-off-by: Abhinav Kumar <[email protected]>
1 parent 2de4d96 commit 3ecc79d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

apps/meteor/client/views/root/MainLayout/LayoutWithSidebar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

apps/meteor/client/views/root/MainLayout/LayoutWithSidebarV2.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)