Skip to content

Fix handling of attrs[:managed] + Refactor OrgsController#admin_update #3529

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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

aaronskiba
Copy link
Contributor

Fixes #3528

Changes proposed in this PR:

  • This change resolves issue BUG: Updating Org Fields Can Set Org.managed to false #3528 by preventing the updating of @org.managed when attrs[:managed] is missing. Prior to this change, the if attrs.key?(:managed) was not present. But it was necessary, because that key is not present when a super user clicks "Save" on the "Request Feedback" page.
  • As a result, if attrs[:managed] was not present, then attrs[:managed] = (attrs[:managed] == '1') would evaluate false, and if @org.update(attrs) (line 81) would subsequently update @org.managed to false in the db.

This change resolves issue DMPRoadmap#3528 by preventing the updating of `@org.managed` when `attrs[:managed]` is missing.
Prior to this change, the `if attrs.key?(:managed)` was not present. But it was necessary, because that key is not present when a super user clicks "Save" on the "Request Feedback" page.
- As a result, if `attrs[:managed]` was not present,  then `attrs[:managed] = (attrs[:managed] == '1')` would evaluate false, and `if @org.update(attrs)` (line 81) would subsequently update `@org.managed` to false in the db.
This refactor is meant to serve as a small step in simplifying  `OrgsController#admin_update` controller action, which currently contains a lot of rubocop offences.

- Moved `attrs[:logo]` handling logic into `handle_logo(attrs)`

- Moved Shibboleth identifier handling into `handle_shibboleth_identifier(attrs)`
@aaronskiba aaronskiba changed the title Fix handling of attrs[:managed] on Org updates Fix handling of attrs[:managed] + Refactor OrgsController#admin_update Jun 2, 2025
@aaronskiba aaronskiba marked this pull request as ready for review June 2, 2025 20:33
@aaronskiba aaronskiba marked this pull request as draft June 6, 2025 18:40
@aaronskiba aaronskiba marked this pull request as ready for review June 9, 2025 15:24
@johnpinto1 johnpinto1 self-requested a review June 17, 2025 14:33
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.

1 participant