-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[63434] Fix user with a particular set of permissions seeing errors when updating work packages dates #18658
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
Merged
cbliard
merged 4 commits into
dev
from
bug/63434-user-with-a-particular-set-of-permissions-sees-error-when-updating-wp-dates
Apr 22, 2025
Merged
[63434] Fix user with a particular set of permissions seeing errors when updating work packages dates #18658
cbliard
merged 4 commits into
dev
from
bug/63434-user-with-a-particular-set-of-permissions-sees-error-when-updating-wp-dates
Apr 22, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Having the route being `datepicker_dialog_content` leads to looking for a `DatepickerDialogContentController`, but that would be wrong as the controller is `DatePickerController`. That's not coherent. That's why routes were moved to `date_picker` so that the routes and the controller are named the same Also moved the `new` action to the collection level so that it does not need a dummy `work_package_id` with value `new` anymore.
It does not need a dummy `work_package_id` with value `new` to render the preview for a work package creation. Refactored the `DialogPreviewController` to simplify the logic used to compute the preview url.
c57c2a0
to
bf7c253
Compare
https://community.openproject.org/wp/63434 The contract class being used was always `WorkPackages::CreateContract`. It needs to be `WorkPackages::UpdateContract` when the user edits fields so that the correct permissions are checked. Also added a spec for the date picker controller.
cbliard
added a commit
that referenced
this pull request
Apr 17, 2025
Seen through a flaky spec: `modules/boards/spec/features/board_enterprise_spec.rb:63` on job https://github.com/opf/openproject/actions/runs/14512895098/job/40715394915 on PR #18658 Reproduction command that worked on my machine: ``` OPENPROJECT_TESTING_NO_HEADLESS=1 CI=true rspec -fd './modules/boards/spec/features/board_enterprise_spec.rb[1:1:2]' './modules/calendar/spec/features/calendar_widget_spec.rb[1:5:2:1]' --seed 61699 ``` It seems the enterprise banner was always present, but the test sometimes passed because the banner was not loaded yet when the test checked for it. It could not be scrolled into but was present. This commit hides the banner if the current user already has enterprise edition.
Fix the flaky spec in another PR. |
oliverguenther
pushed a commit
that referenced
this pull request
Apr 22, 2025
Seen through a flaky spec: `modules/boards/spec/features/board_enterprise_spec.rb:63` on job https://github.com/opf/openproject/actions/runs/14512895098/job/40715394915 on PR #18658 Reproduction command that worked on my machine: ``` OPENPROJECT_TESTING_NO_HEADLESS=1 CI=true rspec -fd './modules/boards/spec/features/board_enterprise_spec.rb[1:1:2]' './modules/calendar/spec/features/calendar_widget_spec.rb[1:5:2:1]' --seed 61699 ``` It seems the enterprise banner was always present, but the test sometimes passed because the banner was not loaded yet when the test checked for it. It could not be scrolled into but was present. This commit hides the banner if the current user already has enterprise edition.
oliverguenther
approved these changes
Apr 22, 2025
The failing spec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/63434
What are you trying to accomplish?
The wrong permissions are checked in the date picker. It always checks for
add_work_packages
, but it should also check foredit_work_packages
when it's an update.Screenshots
What approach did you choose and why?
Use correct contract when calling
SetAttributesService
: eitherUpdateContract
when editing an existing work package orCreateContract
when being with a new work package.I also revised the routing as there was something odd going on when trying to add a controller spec for
DatePickerController
. I kept having some "no route exists" fornew
action, so I made it a bit more sane by:.../datepicker_dialog_content
to.../date_picker
to match controller name and make things easier to find when navigating code.new
action fordate_picker
to the collection level of work_packages scope.new
action forprogress
to the collection level of work_packages scope.Merge checklist