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 valuator's permissions #102

Merged
merged 4 commits into from
Oct 25, 2023
Merged

Fix valuator's permissions #102

merged 4 commits into from
Oct 25, 2023

Conversation

antopalidi
Copy link
Member

No description provided.

@antopalidi antopalidi self-assigned this Oct 9, 2023
@antopalidi antopalidi requested a review from microstudi October 9, 2023 11:55
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (36d868a) 94.33% compared to head (07227bf) 94.65%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   94.33%   94.65%   +0.31%     
==========================================
  Files          66       67       +1     
  Lines        1413     1516     +103     
==========================================
+ Hits         1333     1435     +102     
- Misses         80       81       +1     
Files Coverage Δ
...cipatory_documents/admin/suggestions_controller.rb 98.82% <100.00%> (+0.15%) ⬆️
...ocuments/admin/valuation_assignments_controller.rb 87.09% <100.00%> (+0.88%) ⬆️
...cidim/participatory_documents/admin/permissions.rb 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

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

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

This PR needs specs

if current_participatory_space.user_roles(:valuator).where(user: current_user).empty?
Suggestion.where(suggestable: document).or(Suggestion.where(suggestable: document.sections))
else
valuator_roles = current_participatory_space.user_roles(:valuator).where(user: current_user)
Copy link
Contributor

Choose a reason for hiding this comment

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

We could probaly extract this in a private method and used in the "if" before

@antopalidi
Copy link
Member Author

@microstudi I added tests, did some refactoring. Сould you do the review again

Copy link
Contributor

@microstudi microstudi left a comment

Choose a reason for hiding this comment

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

looks good!

@microstudi microstudi merged commit d2ead67 into main Oct 25, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants