-
Notifications
You must be signed in to change notification settings - Fork 429
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
fix(featurestate-permissions): Add misc extra checks #2712
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2712 +/- ##
==========================================
+ Coverage 95.46% 95.51% +0.04%
==========================================
Files 986 993 +7
Lines 27689 27971 +282
==========================================
+ Hits 26434 26717 +283
+ Misses 1255 1254 -1
☔ View full report in Codecov by Sentry. |
api/features/serializers.py
Outdated
environment = attrs.get("environment") | ||
environment = ( | ||
attrs.get("environment") | ||
or self.context["view"].get_environment_from_request() |
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.
Should we just add the environment to the context instead?
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.
That will trigger an extra query for actions that don't need this, list, for example
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.
Hmm... but it's a trivial query that would simplify the code. Alternatively, we could just check the action in the get_serializer_context
? Maybe this approach is best, but it does feel slightly weird calling methods on the view at this stage of the request.
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.
Yeah, that's a good idea. have updated it
8904d98
to
581648e
Compare
Co-authored-by: Matthew Elwell <[email protected]>
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingChanges
Add misc checks to feature state view set
How did you test this code?
Adds unit test cases