Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/app/types/integrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ export type AppOrProviderOrPlugin =
/**
* Webhooks and servicehooks
*/
export type WebhookEvent = 'issue' | 'error' | 'comment' | 'seer';
export type WebhookEvent = 'issue' | 'error' | 'comment' | 'seer' | 'size_analysis';

export type ServiceHook = {
dateCreated: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
export const EVENT_CHOICES = ['issue', 'error', 'comment', 'seer'] as const;
export const EVENT_CHOICES = [
'issue',
'error',
'comment',
'seer',
'size_analysis',
] as const;

export const PERMISSIONS_MAP = {
issue: 'Event',
error: 'Event',
comment: 'Event',
seer: 'Event',
size_analysis: 'Project',
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const getEventTypes = memoize((app: SentryApp) => {
]
: []),
...issueLinkEvents,
...(app.events.includes('size_analysis') ? ['size_analysis.completed'] : []),
];

return events;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,26 @@ describe('SubscriptionBox', () => {
)
).toBeInTheDocument();
});

describe('size_analysis resource subscription', () => {
it('checkbox disabled without preprod-size-analysis-webhooks flag', async () => {
renderComponent({resource: 'size_analysis'});

expect(screen.getByRole('checkbox')).toBeDisabled();

await userEvent.hover(screen.getByRole('checkbox'));
expect(
await screen.findByText(
'Your organization does not have access to the size analysis subscription resource.'
)
).toBeInTheDocument();
});

it('checkbox visible with preprod-size-analysis-webhooks flag', () => {
org = OrganizationFixture({features: ['preprod-size-analysis-webhooks']});
renderComponent({resource: 'size_analysis', organization: org});

expect(screen.getByRole('checkbox')).toBeEnabled();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ function SubscriptionBox({
);
}

if (
resource === 'size_analysis' &&
!features.includes('preprod-size-analysis-webhooks')
) {
disabled = true;
message = t(
'Your organization does not have access to the size analysis subscription resource.'
);
}

if (webhookDisabled) {
message = t('Cannot enable webhook subscription without specifying a webhook url');
}
Expand All @@ -56,6 +66,7 @@ function SubscriptionBox({
error: 'created',
comment: 'created, edited, deleted',
seer: 'root_cause_started, root_cause_completed, solution_started, solution_completed, coding_started, coding_completed, pr_created',
size_analysis: 'completed',
};

return (
Expand Down
Loading