Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix GH integrations authorize CTA (#42057)

Joshen Limfbfdd0d311cc
diff --git a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
index 3a73f702b32..9ce834daa0b 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
@@ -1,6 +1,7 @@
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useMemo } from 'react'
+import { useGitHubAuthorizationQuery } from '@/data/integrations/github-authorization-query'
import { useParams } from 'common'
import {
ScaffoldContainer,
@@ -37,6 +38,8 @@ export const GitHubSection = () => {
const isProPlanAndUp = organization?.plan?.id !== 'free'
const promptProPlanUpgrade = IS_PLATFORM && !isProPlanAndUp
+ const { data: gitHubAuthorization } = useGitHubAuthorizationQuery()
+
const { data: connections } = useGitHubConnectionsQuery(
{ organizationId: organization?.id },
{ enabled: !!projectRef && !!organization?.id }
@@ -82,10 +85,15 @@ export const GitHubSection = () => {
/>
</div>
)}
- <GitHubIntegrationConnectionForm
- disabled={promptProPlanUpgrade}
- connection={existingConnection}
- />
+
+ {/* [Joshen] Show connection form if GH has already been authorized OR no GH authorization but on a paid plan */}
+ {/* So this shouldn't render if there's no GH authorization and on a free plan */}
+ {(!!gitHubAuthorization || !promptProPlanUpgrade) && (
+ <GitHubIntegrationConnectionForm
+ disabled={promptProPlanUpgrade}
+ connection={existingConnection}
+ />
+ )}
</div>
</div>
)}