diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-05-29 18:42:59 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-05-29 18:42:59 +0300 |
commit | e79f91df8c2a38238ebe5c76862d2f35307bb7f5 (patch) | |
tree | 14f6370b8a79f4cf6de1652f763da9fbd49f6faf /app/services | |
parent | 58c50d40524e0b0c23d4c5d7782583e3742047ba (diff) | |
parent | 1c5106fadfe59ec4af7235b94d424e4367185c2e (diff) |
Merge branch '46758-fallout-of-cacheable-attribute' into 'master'
Ensure ApplicationSetting#performance_bar_allowed_group_id is properly set when retrieved from cache
Closes #46758
See merge request gitlab-org/gitlab-ce!19144
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/application_settings/update_service.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/services/application_settings/update_service.rb b/app/services/application_settings/update_service.rb index d6d3a661dab..e70445cfb67 100644 --- a/app/services/application_settings/update_service.rb +++ b/app/services/application_settings/update_service.rb @@ -3,6 +3,10 @@ module ApplicationSettings def execute update_terms(@params.delete(:terms)) + if params.key?(:performance_bar_allowed_group_path) + params[:performance_bar_allowed_group_id] = performance_bar_allowed_group_id + end + @application_setting.update(@params) end @@ -18,5 +22,13 @@ module ApplicationSettings ApplicationSetting::Term.create(terms: terms) @application_setting.reset_memoized_terms end + + def performance_bar_allowed_group_id + performance_bar_enabled = !params.key?(:performance_bar_enabled) || params.delete(:performance_bar_enabled) + group_full_path = params.delete(:performance_bar_allowed_group_path) + return nil unless Gitlab::Utils.to_boolean(performance_bar_enabled) + + Group.find_by_full_path(group_full_path)&.id if group_full_path.present? + end end end |