Fix handling of `attrs[:managed]` + Refactor `OrgsController#admin_update` by aaronskiba · Pull Request #3529 · DMPRoadmap/roadmap

@aaronskiba changed the title Fix handling of attrs[:managed] on Org updates Fix handling of attrs[:managed] + Refactor OrgsController#admin_update

Jun 2, 2025
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

johnpinto1

@aaronskiba aaronskiba changed the base branch from main to next-release/v5.0.3

December 4, 2025 22:21