From 34548ba49cf4a700b9c607cc6f691feb2a9a48e0 Mon Sep 17 00:00:00 2001 From: Colleen O'Rourke Date: Fri, 11 Aug 2023 15:11:55 -0700 Subject: [PATCH 1/4] ref(alerts) Remove name field from conditions and actions --- static/app/types/alerts.tsx | 1 - static/app/views/alerts/rules/issue/index.tsx | 1 - 2 files changed, 2 deletions(-) diff --git a/static/app/types/alerts.tsx b/static/app/types/alerts.tsx index f8c495b3ad2931..b6d729fe915933 100644 --- a/static/app/types/alerts.tsx +++ b/static/app/types/alerts.tsx @@ -28,7 +28,6 @@ export interface IssueAlertRuleActionTemplate { enabled: boolean; id: string; label: string; - name: string; actionType?: 'ticket' | 'sentryapp'; formFields?: | { diff --git a/static/app/views/alerts/rules/issue/index.tsx b/static/app/views/alerts/rules/issue/index.tsx index 39f057d299a21b..0554636f429f69 100644 --- a/static/app/views/alerts/rules/issue/index.tsx +++ b/static/app/views/alerts/rules/issue/index.tsx @@ -347,7 +347,6 @@ class IssueRuleEditor extends DeprecatedAsyncView { { id, label: CHANGE_ALERT_PLACEHOLDERS_LABELS[id], - name: 'A new issue is created', }, ]); } From 8759a254f651ceca5bacaeadfaeba648b0dc18b4 Mon Sep 17 00:00:00 2001 From: Colleen O'Rourke Date: Mon, 14 Aug 2023 16:29:03 -0700 Subject: [PATCH 2/4] don't pass name on duplicate --- static/app/views/alerts/rules/issue/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/static/app/views/alerts/rules/issue/index.tsx b/static/app/views/alerts/rules/issue/index.tsx index 0554636f429f69..8fb24c94c9af03 100644 --- a/static/app/views/alerts/rules/issue/index.tsx +++ b/static/app/views/alerts/rules/issue/index.tsx @@ -602,6 +602,13 @@ class IssueRuleEditor extends DeprecatedAsyncView { if (actionName === 'SlackNotifyServiceAction') { transaction.setTag(actionName, true); } + delete action.name; + } + for (const condition of rule.conditions) { + delete condition.name; + } + for (const filter of rule.filters) { + delete filter.name; } transaction.setData('actions', rule.actions); } From 87e227d7b54829f83ddf5af257a736e56d27a575 Mon Sep 17 00:00:00 2001 From: Colleen O'Rourke Date: Mon, 14 Aug 2023 16:56:53 -0700 Subject: [PATCH 3/4] Add a comment why I'm doing this --- static/app/views/alerts/rules/issue/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/static/app/views/alerts/rules/issue/index.tsx b/static/app/views/alerts/rules/issue/index.tsx index 8fb24c94c9af03..78a7eec9ab4e34 100644 --- a/static/app/views/alerts/rules/issue/index.tsx +++ b/static/app/views/alerts/rules/issue/index.tsx @@ -602,6 +602,7 @@ class IssueRuleEditor extends DeprecatedAsyncView { if (actionName === 'SlackNotifyServiceAction') { transaction.setTag(actionName, true); } + // to avoid storing inconsistent data in the db, don't pass the name fields delete action.name; } for (const condition of rule.conditions) { From c2c1a092f5249d000997cede688010e3a9c89455 Mon Sep 17 00:00:00 2001 From: Colleen O'Rourke Date: Mon, 14 Aug 2023 18:11:27 -0700 Subject: [PATCH 4/4] update tests to not expect the name --- static/app/views/alerts/create.spec.tsx | 6 ------ 1 file changed, 6 deletions(-) diff --git a/static/app/views/alerts/create.spec.tsx b/static/app/views/alerts/create.spec.tsx index 883558f96be963..b239397faa0852 100644 --- a/static/app/views/alerts/create.spec.tsx +++ b/static/app/views/alerts/create.spec.tsx @@ -169,7 +169,6 @@ describe('ProjectAlertsCreate', function () { conditions: [ expect.objectContaining({ id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', - name: 'A new issue is created', }), ], filterMatch: 'all', @@ -263,7 +262,6 @@ describe('ProjectAlertsCreate', function () { conditions: [ expect.objectContaining({ id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', - name: 'A new issue is created', }), ], filterMatch: 'all', @@ -321,7 +319,6 @@ describe('ProjectAlertsCreate', function () { conditions: [ expect.objectContaining({ id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', - name: 'A new issue is created', }), ], actions: [], @@ -371,7 +368,6 @@ describe('ProjectAlertsCreate', function () { conditions: [ expect.objectContaining({ id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', - name: 'A new issue is created', }), ], filterMatch: 'all', @@ -474,7 +470,6 @@ describe('ProjectAlertsCreate', function () { conditions: [ expect.objectContaining({ id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', - name: 'A new issue is created', }), ], filterMatch: 'all', @@ -522,7 +517,6 @@ describe('ProjectAlertsCreate', function () { conditions: [ expect.objectContaining({ id: 'sentry.rules.conditions.first_seen_event.FirstSeenEventCondition', - name: 'A new issue is created', }), ], filterMatch: 'all',