Skip to content

Conversation

@johnpinto1
Copy link
Contributor

…using API V0".

Fix for DCC issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/710

Changes:

  • the route for PATCH unassign_users_api_v0_department was wrongly
    defined, it was missing the parameter for department id.
  • In app/controllers/api/v0/departments_controller.rb

…using API V0".

Fix for DCC issue https://github.com/DigitalCurationCentre/DMPonline-Service/issues/710

Changes:
- the route for PATCH unassign_users_api_v0_department was wrongly
defined, it was missing the parameter for department id.
- In app/controllers/api/v0/departments_controller.rb
  - fixed a typo in unassign_users() method raise Pudndit::NotAuthorizedError
instead of Pundit::NotAuthorizedError
  - in assign_users() and assign_users() the redirect_to was failing
    as it was treated as a PATCH based on original API call, rather than
    being redirect as GET. Fixed by adding status "See Other" to
    redirect_to
      redirect_to users_api_v0_departments_path, status: :see_other
    based on https://makandracards.com/makandra/38347-redirecting-responses-for-patch-or-delete-will-not-redirect-with-get
@briri briri merged commit d482e17 into development Mar 31, 2022
@briri briri deleted the dcc_bug_710-Error_using_unassign_users_from_a_Department_using_API_V0 branch March 31, 2022 15:55
@briri briri mentioned this pull request Apr 6, 2022
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.

4 participants