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: Feature id in mv-option request is undefined #2751

Merged
merged 6 commits into from
Sep 12, 2023

Conversation

novakzaballa
Copy link
Contributor

@novakzaballa novakzaballa commented Sep 6, 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

  • The feature ID is no longer undefined.
  • It is validated that the feature ID is in the request.

How did you test this code?

  • Create a new MV feature.
  • (API) Covered by unit tests.

@vercel
Copy link

vercel bot commented Sep 6, 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 12, 2023 5:30pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2023 5:30pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 12, 2023 5:30pm

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard api Issue related to the REST API labels Sep 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

Uffizzi Preview deployment-35385 was deleted.

@novakzaballa novakzaballa requested review from a team and matthewelwell September 6, 2023 22:24
api/features/multivariate/views.py Outdated Show resolved Hide resolved
api/features/multivariate/views.py Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2023

Codecov Report

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

Comparison is base (ecb7fd2) 95.51% compared to head (4397eda) 95.53%.
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2751      +/-   ##
==========================================
+ Coverage   95.51%   95.53%   +0.01%     
==========================================
  Files         993      993              
  Lines       27971    28058      +87     
==========================================
+ Hits        26717    26805      +88     
+ Misses       1254     1253       -1     
Files Changed Coverage Δ
api/features/multivariate/views.py 96.77% <100.00%> (+0.62%) ⬆️
...ures/multivariate/test_integration_multivariate.py 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

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

@@ -33,6 +33,16 @@ def get_permissions(self):
)
]

def create(self, request, *args, **kwargs):
feature_pk = self.kwargs.get("feature_pk")
get_object_or_404(Feature, pk=feature_pk)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still isn't checking that it's a project they belong to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being checked here, right?

def get_permissions(self):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, looks like that is checking they have permissions on the project. So it should be sufficient to change this to:

feature_pk = self.kwargs.get("feature_pk")
project_pk = self.kwargs.get("project_pk")
get_object_or_404(Feature.objects.filter(project__id=project_pk), pk=feature_pk)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I understand what you meant, Thank you, corrected.

api/features/multivariate/views.py Outdated Show resolved Hide resolved
@novakzaballa novakzaballa merged commit 3c3b1d7 into main Sep 12, 2023
@novakzaballa novakzaballa deleted the fix/feature-id-in-mv-option-request-is-undefined branch September 12, 2023 20:43
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 front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FE posts MV options to /features/undefined/mv-options/ when creating a new feature
3 participants