Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 6c861d1

Browse files
authored
add back /post-sign-up (#63456)
This is needed for the signup flow to work. ## Test plan Manually test
1 parent 91bc23d commit 6c861d1

File tree

9 files changed

+74
-3
lines changed

9 files changed

+74
-3
lines changed

client/web-sveltekit/src/params/reporev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const topLevelPaths = [
3333
'search/cody',
3434
'app',
3535
'cody',
36+
'post-sign-up',
3637
'unlock-account',
3738
'password-reset',
3839
'survey',

client/web/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ ts_project(
160160
"src/auth/AuthPageWrapper.tsx",
161161
"src/auth/CloudSignUpPage.tsx",
162162
"src/auth/OrDivider.tsx",
163+
"src/auth/PostSignUpPage.tsx",
163164
"src/auth/RequestAccessPage.tsx",
164165
"src/auth/ResetPasswordPage.tsx",
165166
"src/auth/SignInPage.tsx",

client/web/src/LegacyLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const LegacyLayout: FC<LegacyLayoutProps> = props => {
101101
[PageRoutes.SignIn, PageRoutes.SignUp, PageRoutes.PasswordReset, PageRoutes.RequestAccess].includes(
102102
routeMatch as PageRoutes
103103
)
104+
const isPostSignUpPage = location.pathname === PageRoutes.PostSignUp.toString()
104105

105106
const [newSearchNavigation] = useNewSearchNavigation()
106107
const [enableContrastCompliantSyntaxHighlighting] = useFeatureFlag('contrast-compliant-syntax-highlighting')
@@ -222,7 +223,7 @@ export const LegacyLayout: FC<LegacyLayoutProps> = props => {
222223
telemetryRecorder={props.platformContext.telemetryRecorder}
223224
/>
224225
)}
225-
{!isSiteInit && !isSignInOrUp && (
226+
{!isSiteInit && !isSignInOrUp && !isPostSignUpPage && (
226227
<>
227228
{newSearchNavigation ? (
228229
<NewGlobalNavigationBar
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
3+
import { Navigate, useLocation } from 'react-router-dom'
4+
5+
import { getReturnTo } from './SignInSignUpCommon'
6+
7+
export const PostSignUpPage: React.FunctionComponent = () => {
8+
const location = useLocation()
9+
const returnTo = getReturnTo(location)
10+
11+
// Redirects Cody PLG users without asking
12+
const params = new URLSearchParams()
13+
params.set('returnTo', returnTo)
14+
15+
const navigateTo = '/sign-in?' + params.toString()
16+
17+
return <Navigate to={navigateTo.toString()} replace={true} />
18+
}

client/web/src/auth/SignUpPage.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import { Container, Link, Text } from '@sourcegraph/wildcard'
1111
import type { AuthenticatedUser } from '../auth'
1212
import { PageTitle } from '../components/PageTitle'
1313
import type { SourcegraphContext } from '../jscontext'
14+
import { PageRoutes } from '../routes.constants'
1415
import { EventName } from '../util/constants'
1516

1617
import { AuthPageWrapper } from './AuthPageWrapper'
1718
import { CloudSignUpPage, ShowEmailFormQueryParameter } from './CloudSignUpPage'
1819
import { getReturnTo } from './SignInSignUpCommon'
19-
import { SignUpForm, type SignUpArguments } from './SignUpForm'
20+
import { type SignUpArguments, SignUpForm } from './SignUpForm'
2021
import { VsCodeSignUpPage } from './VsCodeSignUpPage'
2122

2223
import styles from './SignUpPage.module.scss'
@@ -91,7 +92,8 @@ export const SignUpPage: React.FunctionComponent<React.PropsWithChildren<SignUpP
9192
const v2Source = query.get('editor') === 'vscode' ? 0 : 1
9293
telemetryRecorder.recordEvent('auth.signUp', 'complete', { metadata: { source: v2Source } })
9394

94-
window.location.replace(returnTo)
95+
// Redirects to the /post-sign-up after successful signup on sourcegraphDotCom.
96+
window.location.replace(context.sourcegraphDotComMode ? PageRoutes.PostSignUp : returnTo)
9597

9698
return Promise.resolve()
9799
})

client/web/src/auth/__snapshots__/PostSignUpPage.test.tsx.snap

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/web/src/routes.constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export enum PageRoutes {
44
SearchConsole = '/search/console',
55
SignIn = '/sign-in',
66
SignUp = '/sign-up',
7+
PostSignUp = '/post-sign-up',
78
UnlockAccount = '/unlock-account/:token',
89
Settings = '/settings',
910
User = '/user/*',

client/web/src/routes.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const RepoContainer = lazyComponent(() => import('./repo/RepoContainer'), 'RepoC
3030
const TeamsArea = lazyComponent(() => import('./team/TeamsArea'), 'TeamsArea')
3131
const CodySidebarStoreProvider = lazyComponent(() => import('./cody/sidebar/Provider'), 'CodySidebarStoreProvider')
3232
const CodyIgnoreProvider = lazyComponent(() => import('./cody/useCodyIgnore'), 'CodyIgnoreProvider')
33+
const PostSignUpPage = lazyComponent(() => import('./auth/PostSignUpPage'), 'PostSignUpPage')
3334

3435
const GlobalNotebooksArea = lazyComponent(() => import('./notebooks/GlobalNotebooksArea'), 'GlobalNotebooksArea')
3536
const GlobalBatchChangesArea = lazyComponent(
@@ -85,6 +86,10 @@ const PassThroughToServer: React.FC = () => {
8586
* See https://reacttraining.com/react-router/web/example/sidebar
8687
*/
8788
export const routes: RouteObject[] = [
89+
{
90+
path: PageRoutes.PostSignUp,
91+
element: <LegacyRoute render={() => <PostSignUpPage />} />,
92+
},
8893
{
8994
path: PageRoutes.Index,
9095
element: <Index />,

cmd/frontend/internal/app/ui/router.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ func InitRouter(db database.DB) {
155155
{path: "/cody", name: "cody", title: "Cody", index: false},
156156
// TODO: [TEMPORARY] remove this redirect route when the marketing page is added.
157157
{path: "/cody/{chatID}", name: "cody-chat", title: "Cody", index: false},
158+
{path: "/post-sign-up", name: "post-sign-up", title: "Cody", index: false},
158159
{path: "/unlock-account/{token}", name: uirouter.RouteUnlockAccount, title: "Unlock Your Account", index: false},
159160
{path: "/password-reset", name: uirouter.RoutePasswordReset, title: "Reset password", index: false},
160161
{path: "/survey", name: "survey", title: "Survey", index: false},

0 commit comments

Comments
 (0)