diff --git a/src/sentry/api/endpoints/organization_details.py b/src/sentry/api/endpoints/organization_details.py index 98e3de6584494e..486a15ce378a36 100644 --- a/src/sentry/api/endpoints/organization_details.py +++ b/src/sentry/api/endpoints/organization_details.py @@ -137,6 +137,12 @@ bool, org_serializers.GITHUB_PR_BOT_DEFAULT, ), + ( + "githubOpenPRComments", + "sentry:github_open_pr_comments", + bool, + org_serializers.GITHUB_OPEN_PR_COMMENTS_DEFAULT, + ), ) DELETION_STATUSES = frozenset( @@ -180,6 +186,7 @@ class OrganizationSerializer(BaseOrganizationSerializer): isEarlyAdopter = serializers.BooleanField(required=False) aiSuggestedSolution = serializers.BooleanField(required=False) codecovAccess = serializers.BooleanField(required=False) + githubOpenPRComments = serializers.BooleanField(required=False) githubPRBot = serializers.BooleanField(required=False) require2FA = serializers.BooleanField(required=False) requireEmailVerification = serializers.BooleanField(required=False) diff --git a/src/sentry/api/serializers/models/organization.py b/src/sentry/api/serializers/models/organization.py index 2f97e5f77bda0a..764d1fc5a9f111 100644 --- a/src/sentry/api/serializers/models/organization.py +++ b/src/sentry/api/serializers/models/organization.py @@ -42,6 +42,7 @@ ATTACHMENTS_ROLE_DEFAULT, DEBUG_FILES_ROLE_DEFAULT, EVENTS_MEMBER_ADMIN_DEFAULT, + GITHUB_OPEN_PR_COMMENTS_DEFAULT, GITHUB_PR_BOT_DEFAULT, JOIN_REQUESTS_DEFAULT, PROJECT_RATE_LIMIT_DEFAULT, @@ -417,6 +418,7 @@ class DetailedOrganizationSerializerResponse(_DetailedOrganizationSerializerResp codecovAccess: bool aiSuggestedSolution: bool githubPRBot: bool + githubOpenPRComments: bool isDynamicallySampled: bool @@ -523,6 +525,11 @@ def serialize( # type: ignore obj.get_option("sentry:ai_suggested_solution", AI_SUGGESTED_SOLUTION) ), "githubPRBot": bool(obj.get_option("sentry:github_pr_bot", GITHUB_PR_BOT_DEFAULT)), + "githubOpenPRComments": bool( + obj.get_option( + "sentry:github_open_pr_comments", GITHUB_OPEN_PR_COMMENTS_DEFAULT + ) + ), } ) diff --git a/src/sentry/constants.py b/src/sentry/constants.py index f6ab31b01c8dac..54d31ebd9f7473 100644 --- a/src/sentry/constants.py +++ b/src/sentry/constants.py @@ -633,6 +633,7 @@ def from_str(cls, string: str) -> Optional[int]: APDEX_THRESHOLD_DEFAULT = 300 AI_SUGGESTED_SOLUTION = True GITHUB_PR_BOT_DEFAULT = True +GITHUB_OPEN_PR_COMMENTS_DEFAULT = True # `sentry:events_member_admin` - controls whether the 'member' role gets the event:admin scope EVENTS_MEMBER_ADMIN_DEFAULT = True diff --git a/static/app/types/organization.tsx b/static/app/types/organization.tsx index 51eccd14a09760..163a29ef921b67 100644 --- a/static/app/types/organization.tsx +++ b/static/app/types/organization.tsx @@ -17,6 +17,7 @@ export interface OrganizationSummary { codecovAccess: boolean; dateCreated: string; features: string[]; + githubOpenPRComments: boolean; githubPRBot: boolean; id: string; isEarlyAdopter: boolean; diff --git a/static/app/views/settings/organizationIntegrations/integrationDetailedView.tsx b/static/app/views/settings/organizationIntegrations/integrationDetailedView.tsx index 2a62ed6dc2a1b2..2f6f96dfaabf94 100644 --- a/static/app/views/settings/organizationIntegrations/integrationDetailedView.tsx +++ b/static/app/views/settings/organizationIntegrations/integrationDetailedView.tsx @@ -331,28 +331,46 @@ class IntegrationDetailedView extends AbstractIntegrationDetailedView< const hasIntegration = configurations ? configurations.length > 0 : false; const endpoint = `/organizations/${organization.slug}/`; const hasOrgWrite = organization.access.includes('org:write'); - + let openPRDisabledReason = t( + 'You must have a GitHub integration to enable this feature.' + ); + if (!organization.features.includes('integrations-open-pr-comment')) { + openPRDisabledReason = t("This feature isn't available to you yet."); + } const forms: JsonFormObject[] = [ { fields: [ { name: 'githubPRBot', type: 'boolean', - label: t('Enable Pull Request Bot'), + label: t('Enable Comments on Suspect Pull Requests'), help: t( - 'Allow Sentry to comment on pull requests about issues impacting your app.' + 'Allow Sentry to comment on recent pull requests suspected of causing issues.' ), disabled: !hasIntegration, disabledReason: t( 'You must have a GitHub integration to enable this feature.' ), }, + { + name: 'githubOpenPRComments', + type: 'boolean', + label: t('Enable Comments on Open Pull Requests'), + help: t( + 'Allow Sentry to comment on open pull requests to show recent error and performance issues for the code being changed.' + ), + disabled: + !hasIntegration || + !organization.features.includes('integrations-open-pr-comment'), + disabledReason: openPRDisabledReason, + }, ], }, ]; const initialData = { githubPRBot: organization.githubPRBot, + githubOpenPRComments: organization.githubOpenPRComments, }; return (