-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(releases): Support filtering by release.created
#104877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,12 @@ | |
| MergingOffsetPaginator, | ||
| OffsetPaginator, | ||
| ) | ||
| from sentry.api.release_search import FINALIZED_KEY, RELEASE_FREE_TEXT_KEY, parse_search_query | ||
| from sentry.api.release_search import ( | ||
| FINALIZED_KEY, | ||
| RELEASE_CREATED_KEY, | ||
| RELEASE_FREE_TEXT_KEY, | ||
| parse_search_query, | ||
| ) | ||
| from sentry.api.serializers import serialize | ||
| from sentry.api.serializers.rest_framework import ( | ||
| ReleaseHeadCommitSerializer, | ||
|
|
@@ -166,6 +171,13 @@ def _filter_releases_by_query(queryset, organization, query, filter_params): | |
| negated=negated, | ||
| ) | ||
|
|
||
| if search_filter.key.name == RELEASE_CREATED_KEY: | ||
| queryset = queryset.filter( | ||
| **{ | ||
| f"date_added__{OPERATOR_TO_DJANGO[search_filter.operator]}": search_filter.value.raw_value | ||
| } | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Missing negation handling causes KeyError with
|
||
|
|
||
| return queryset | ||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing negation handling causes KeyError with
!=operatorThe
RELEASE_CREATED_KEYfilter directly accessesOPERATOR_TO_DJANGO[search_filter.operator], butOPERATOR_TO_DJANGOdoes not include the!=operator. When a user queries withrelease.created:!=<date>, this will raise aKeyError. The adjacentSEMVER_BUILD_ALIASfilter correctly handles this by callinghandle_operator_negation()first to convert!=to=and extract anegatedflag, then usingexclude()when negated.