ref(alerts): Don't pass "name" field #54739
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have inconsistent data stored for issue alert rule data because we are sometimes saving the "name" field for filters, conditions, and actions and sometimes not. This is making it difficult to prevent creation of exact duplicate alerts (which I'm working on here) and makes queries more complicated since the data stored for the same thing has variance.
The first case where we store the "name" field is on
FirstSeenEventCondition
because it is hardcoded. Removing it does not affect the display on the alert details or edit page.The second case is when you duplicate an alert. We do a GET request to the
ProjectRuleDetailsEndpoint
and the serializer adds the "name" fields so the front end can populate the data shown here:We end up with data like:
versus
stored in the database which makes it hard to query and compare. We should not send the "name" field to the backend when creating, duplicating, or updating an issue alert rule to avoid this.
We have a few places in the backend that are hardcoding this as well that I'll remove in a separate PR, and then I'll write a migration to remove it from any existing db rows so we have consistent data.