MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / InvitePage

Function InvitePage

packages/web/src/app/invite/page.tsx:17–55  ·  view source on GitHub ↗
(props: InvitePageProps)

Source from the content-addressed store, hash-verified

15}
16
17export default async function InvitePage(props: InvitePageProps) {
18 const searchParams = await props.searchParams;
19 const org = await __unsafePrisma.org.findUnique({ where: { id: SINGLE_TENANT_ORG_ID } });
20 if (!org || !org.isOnboarded) {
21 return redirect("/onboard");
22 }
23
24 const inviteLinkId = searchParams.id;
25 if (!org.inviteLinkEnabled || !inviteLinkId || org.inviteLinkId !== inviteLinkId) {
26 return notFound();
27 }
28
29 const session = await auth();
30 if (!session) {
31 return <WelcomeCard inviteLinkId={inviteLinkId} />;
32 }
33
34 const membership = await __unsafePrisma.userToOrg.findUnique({
35 where: {
36 orgId_userId: {
37 orgId: org.id,
38 userId: session.user.id
39 }
40 }
41 });
42
43 // If already a member, redirect to the organization
44 if (membership) {
45 redirect(`/`);
46 }
47
48 // User is logged in but not a member, show join invitation
49 return (
50 <div className="min-h-screen flex items-center justify-center p-6">
51 <LogoutEscapeHatch className="absolute top-0 right-0 p-6" />
52 <JoinOrganizationCard inviteLinkId={inviteLinkId} />
53 </div>
54 );
55}
56
57function WelcomeCard({ inviteLinkId }: { inviteLinkId: string; }) {
58 return (

Callers

nothing calls this directly

Calls 2

redirectFunction · 0.85
notFoundFunction · 0.85

Tested by

no test coverage detected