Skip to content

Sync changes in ApplicationSetting to Default Organization

Rutger Wessels requested to merge 394801-sync-setting into master

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

  1. Open rails console and delete all OrganizationSettings
  2. http://localhost:3000/admin/application_settings/general
    • Expand Visibility and access controls
    • Edit Restricted Visibility levels and save
  3. 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.

Related to #394801 (closed)

Edited by Rutger Wessels

Merge request reports