From 1942a9b8a615bf81f10a61f904cf3fb76de95ee5 Mon Sep 17 00:00:00 2001 From: Snigdha Sharma Date: Mon, 23 Sep 2024 12:00:44 -0700 Subject: [PATCH] cleanup(priority-alerts): Remove priority-ga flag from the frontend (#77829) The feature has been GA for a few weeks and alert migrations are complete. We can remove the flag now. --- static/app/views/alerts/create.spec.tsx | 62 +++++++++++++++---- static/app/views/alerts/rules/issue/index.tsx | 12 ++-- .../projectInstall/issueAlertOptions.tsx | 8 +-- 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/static/app/views/alerts/create.spec.tsx b/static/app/views/alerts/create.spec.tsx index 719e7e6f89c032..4027f24bec3723 100644 --- a/static/app/views/alerts/create.spec.tsx +++ b/static/app/views/alerts/create.spec.tsx @@ -161,7 +161,7 @@ describe('ProjectAlertsCreate', function () { 'The issue is older or newer than...', ]); - await userEvent.click(screen.getAllByLabelText('Delete Node')[1]); + await userEvent.click(screen.getAllByLabelText('Delete Node')[2]); await userEvent.click(screen.getByText('Save Rule')); @@ -174,7 +174,10 @@ describe('ProjectAlertsCreate', function () { actions: [], conditions: [ expect.objectContaining({ - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', + id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition', + }), + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', }), ], filterMatch: 'all', @@ -196,7 +199,8 @@ describe('ProjectAlertsCreate', function () { body: ProjectAlertRuleFixture(), }); // delete node - await userEvent.click(screen.getByLabelText('Delete Node')); + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); // Change name of alert rule await userEvent.type(screen.getByPlaceholderText('Enter Alert Name'), 'myname'); @@ -263,7 +267,7 @@ describe('ProjectAlertsCreate', function () { 'Send a notification to all legacy integrations', ]); - await userEvent.click(screen.getAllByLabelText('Delete Node')[1]); + await userEvent.click(screen.getAllByLabelText('Delete Node')[2]); await userEvent.click(screen.getByText('Save Rule')); @@ -276,7 +280,10 @@ describe('ProjectAlertsCreate', function () { actions: [], conditions: [ expect.objectContaining({ - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', + id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition', + }), + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', }), ], filterMatch: 'all', @@ -333,7 +340,10 @@ describe('ProjectAlertsCreate', function () { filterMatch: 'any', conditions: [ expect.objectContaining({ - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', + id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition', + }), + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', }), ], actions: [], @@ -382,7 +392,10 @@ describe('ProjectAlertsCreate', function () { actions: [], conditions: [ expect.objectContaining({ - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', + id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition', + }), + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', }), ], filterMatch: 'all', @@ -442,7 +455,11 @@ describe('ProjectAlertsCreate', function () { }, ], actions: [], - conditions: [], + conditions: [ + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', + }), + ], frequency: 60 * 24, name: 'myname', owner: null, @@ -484,7 +501,10 @@ describe('ProjectAlertsCreate', function () { ], conditions: [ expect.objectContaining({ - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', + id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition', + }), + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', }), ], filterMatch: 'all', @@ -531,7 +551,10 @@ describe('ProjectAlertsCreate', function () { actionMatch: 'any', conditions: [ expect.objectContaining({ - id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', + id: 'sentry.rules.conditions.high_priority_issue.NewHighPriorityIssueCondition', + }), + expect.objectContaining({ + id: 'sentry.rules.conditions.high_priority_issue.ExistingHighPriorityIssueCondition', }), ], filterMatch: 'all', @@ -560,7 +583,8 @@ describe('ProjectAlertsCreate', function () { statusCode: 400, }); createWrapper(); - // delete existion condition + // delete existion conditions + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); await waitFor(() => { @@ -604,6 +628,13 @@ describe('ProjectAlertsCreate', function () { it('shows error for incompatible conditions', async () => { createWrapper(); + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); + + await selectEvent.select(screen.getByText('Add optional trigger...'), [ + 'A new issue is created', + ]); + const anyDropdown = screen.getByText('any'); expect(anyDropdown).toBeInTheDocument(); await selectEvent.select(anyDropdown, ['all']); @@ -624,6 +655,13 @@ describe('ProjectAlertsCreate', function () { it('test any filterMatch', async () => { createWrapper(); + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); + await userEvent.click(screen.getAllByLabelText('Delete Node')[0]); + + await selectEvent.select(screen.getByText('Add optional trigger...'), [ + 'A new issue is created', + ]); + const allDropdown = screen.getByText('all'); await selectEvent.select(allDropdown, ['any']); await selectEvent.select(screen.getByText('Add optional filter...'), [ @@ -669,6 +707,7 @@ describe('ProjectAlertsCreate', function () { createWrapper({organization: {features: ['noisy-alert-warning']}}); await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]); + await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]); await selectEvent.select(screen.getByText('Add action...'), [ 'Suggested Assignees, Team, or Member', @@ -701,6 +740,7 @@ describe('ProjectAlertsCreate', function () { it('does not display noisy alert banner for legacy integrations', async function () { createWrapper({organization: {features: ['noisy-alert-warning']}}); await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]); + await userEvent.click((await screen.findAllByLabelText('Delete Node'))[0]); await selectEvent.select(screen.getByText('Add action...'), [ 'Send a notification to all legacy integrations', diff --git a/static/app/views/alerts/rules/issue/index.tsx b/static/app/views/alerts/rules/issue/index.tsx index 03d782a606c217..9349df36139c14 100644 --- a/static/app/views/alerts/rules/issue/index.tsx +++ b/static/app/views/alerts/rules/issue/index.tsx @@ -326,14 +326,10 @@ class IssueRuleEditor extends DeprecatedAsyncView { if (!ruleId && !this.isDuplicateRule) { // now that we've loaded all the possible conditions, we can populate the // value of conditions for a new alert - if (this.props.organization.features.includes('priority-ga-features')) { - this.handleChange('conditions', [ - {id: IssueAlertConditionType.NEW_HIGH_PRIORITY_ISSUE}, - {id: IssueAlertConditionType.EXISTING_HIGH_PRIORITY_ISSUE}, - ]); - } else { - this.handleChange('conditions', [{id: IssueAlertConditionType.FIRST_SEEN_EVENT}]); - } + this.handleChange('conditions', [ + {id: IssueAlertConditionType.NEW_HIGH_PRIORITY_ISSUE}, + {id: IssueAlertConditionType.EXISTING_HIGH_PRIORITY_ISSUE}, + ]); } } diff --git a/static/app/views/projectInstall/issueAlertOptions.tsx b/static/app/views/projectInstall/issueAlertOptions.tsx index d42ab23acf5b4e..f016865bc00e82 100644 --- a/static/app/views/projectInstall/issueAlertOptions.tsx +++ b/static/app/views/projectInstall/issueAlertOptions.tsx @@ -177,9 +177,7 @@ class IssueAlertOptions extends DeprecatedAsyncComponent { , ]; - const default_label = this.shouldUseNewDefaultSetting() - ? t('Alert me on high priority issues') - : t('Alert me on every new issue'); + const default_label = t('Alert me on high priority issues'); const options: [string, React.ReactNode][] = [ [RuleAction.DEFAULT_ALERT.toString(), default_label], @@ -192,10 +190,6 @@ class IssueAlertOptions extends DeprecatedAsyncComponent { ]); } - shouldUseNewDefaultSetting(): boolean { - return this.props.organization.features.includes('priority-ga-features'); - } - getUpdatedData(): RequestDataFragment { let defaultRules: boolean; let shouldCreateCustomRule: boolean;