Skip to content

Commit

Permalink
cleanup(priority-alerts): Remove priority-ga flag from the frontend (#…
Browse files Browse the repository at this point in the history
…77829)

The feature has been GA for a few weeks and alert migrations are
complete. We can remove the flag now.
  • Loading branch information
snigdhas committed Sep 23, 2024
1 parent ef8fbd8 commit 1942a9b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
62 changes: 51 additions & 11 deletions static/app/views/alerts/create.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand All @@ -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',
Expand 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');
Expand Down Expand Up @@ -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'));

Expand All @@ -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',
Expand Down Expand Up @@ -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: [],
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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']);
Expand 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...'), [
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
12 changes: 4 additions & 8 deletions static/app/views/alerts/rules/issue/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,10 @@ class IssueRuleEditor extends DeprecatedAsyncView<Props, State> {
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},
]);
}
}

Expand Down
8 changes: 1 addition & 7 deletions static/app/views/projectInstall/issueAlertOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ class IssueAlertOptions extends DeprecatedAsyncComponent<Props, State> {
</CustomizeAlert>,
];

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],
Expand All @@ -192,10 +190,6 @@ class IssueAlertOptions extends DeprecatedAsyncComponent<Props, State> {
]);
}

shouldUseNewDefaultSetting(): boolean {
return this.props.organization.features.includes('priority-ga-features');
}

getUpdatedData(): RequestDataFragment {
let defaultRules: boolean;
let shouldCreateCustomRule: boolean;
Expand Down

0 comments on commit 1942a9b

Please sign in to comment.