summaryrefslogtreecommitdiff
path: root/app/services/application_settings
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-05-25 18:44:15 +0200
committerRémy Coutable <remy@rymai.me>2018-05-29 10:38:59 +0200
commit2b8eb7273efee84180b322a0aac33e1f4ee30d2c (patch)
tree9afd597903504acf183d93505e6c19aabea1207a /app/services/application_settings
parentc5adf04cd69035a7a1737df8c2303bc228ea4089 (diff)
downloadgitlab-ce-2b8eb7273efee84180b322a0aac33e1f4ee30d2c.tar.gz
Ensure ApplicationSetting#performance_bar_allowed_group_id is properly set when retrieved from cache
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services/application_settings')
-rw-r--r--app/services/application_settings/update_service.rb12
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