Sync changes in ApplicationSetting to Default Organization
What does this MR do and why?
In MR !123380 (merged), we added one ApplicationSetting (restricted_visibility_levels
) to OrganizationSetting
model.
This MR will sync changes in ApplicationSetting
to OrganizationSetting
. This is needed because we do not have a UI for OrganizationSettings.
Implementation
- Sync logic is in
ApplicationSettings::SyncService
- It is now called from the
ApplicationSettings::UpdaterService
which is used in a few places, including the controller that handles updates from the UI
We have a few database migrations that are modifying ApplicationSetting
without using this UpdaterService
or the ActiveRecord model. Those changes are missed in this MR. At some point, we will start to remove settings from ApplicationSetting so I think it is acceptable. New settings need to be added either to ApplicationSetting (instance level) or OrganzationSetting (organization level).
We could also consider adding a job that runs this service periodically.
How to set up and validate locally
- Open rails console and delete all OrganizationSettings
-
http://localhost:3000/admin/application_settings/general
- Expand Visibility and access controls
- Edit Restricted Visibility levels and save
- In rails console:
-
ApplicationSetting.first.restriced_visiblity_levels
should be updated -
Organizations::Organization.default_organization.settings.restricted_visibility_levels
should be updated and match ApplicationSetting
-
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #394801 (closed)