-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(github): add open PR comments toggle and org option #54706
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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."); | ||
} | ||
Comment on lines
+334
to
+339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you hide the toggle when the org doesn't have the feature flag you won't need this extra reason |
||
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'), | ||
Comment on lines
+362
to
+364
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of checking for the feature here, you can add another field to this blob like this visible: ({features}) => features.has('integrations-open-pr-comment') this hides the toggle entirely if the org doesn't have the feature flag then you can pass features into the JsonForm <JsonForm features={organization.features} forms={forms} /> |
||
disabledReason: openPRDisabledReason, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const initialData = { | ||
githubPRBot: organization.githubPRBot, | ||
githubOpenPRComments: organization.githubOpenPRComments, | ||
}; | ||
|
||
return ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm i feel like this name is pretty lengthy. maybe
githubOpenPRBot
would be better?