Skip to content
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

Merged
merged 10 commits into from
Sep 6, 2023

Conversation

gagantrivedi
Copy link
Member

@gagantrivedi gagantrivedi commented Aug 31, 2023

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

Add misc checks to feature state view set

How did you test this code?

Adds unit test cases

@vercel
Copy link

vercel bot commented Aug 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2023 11:07am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2023 11:07am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 6, 2023 11:07am

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2023

Uffizzi Preview deployment-34894 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Aug 31, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04% 🎉

Comparison is base (a46295b) 95.46% compared to head (539bfb5) 95.51%.
Report is 31 commits behind head on main.

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     
Files Changed Coverage Δ
api/environments/tests/test_views.py 100.00% <ø> (ø)
api/features/serializers.py 95.59% <100.00%> (+0.24%) ⬆️
api/features/views.py 85.35% <100.00%> (+2.12%) ⬆️
api/tests/unit/conftest.py 96.59% <100.00%> (+0.12%) ⬆️
...pi/tests/unit/features/test_unit_features_views.py 100.00% <100.00%> (ø)

... and 22 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

environment = attrs.get("environment")
environment = (
attrs.get("environment")
or self.context["view"].get_environment_from_request()
Copy link
Contributor

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?

Copy link
Member Author

@gagantrivedi gagantrivedi Sep 5, 2023

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

Copy link
Contributor

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.

Copy link
Member Author

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

@gagantrivedi gagantrivedi merged commit ecb7fd2 into main Sep 6, 2023
@gagantrivedi gagantrivedi deleted the fix/fs-permissions branch September 6, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants