Commit 189fdb78 authored by Fabio Pitino's avatar Fabio Pitino

Merge branch 'issue_344279_app_1' into 'master'

Fix Style/OpenStructUse offenses in application settings helper

See merge request gitlab-org/gitlab!75993
parents 16ac1450 c45a1f06
--- ---
Style/OpenStructUse: Style/OpenStructUse:
Exclude: Exclude:
- app/helpers/application_settings_helper.rb
- ee/spec/features/projects/new_project_spec.rb - ee/spec/features/projects/new_project_spec.rb
- ee/spec/finders/template_finder_spec.rb - ee/spec/finders/template_finder_spec.rb
- ee/spec/helpers/ee/blob_helper_spec.rb - ee/spec/helpers/ee/blob_helper_spec.rb
......
...@@ -37,9 +37,15 @@ module ApplicationSettingsHelper ...@@ -37,9 +37,15 @@ module ApplicationSettingsHelper
end end
def storage_weights def storage_weights
Gitlab.config.repositories.storages.keys.each_with_object(OpenStruct.new) do |storage, weights| # Instead of using a `Struct` we could wrap this into an object.
weights[storage.to_sym] = @application_setting.repository_storages_weighted[storage] || 0 # See https://gitlab.com/gitlab-org/gitlab/-/issues/358419
weights = Struct.new(*Gitlab.config.repositories.storages.keys.map(&:to_sym))
values = Gitlab.config.repositories.storages.keys.map do |storage|
@application_setting.repository_storages_weighted[storage] || 0
end end
weights.new(*values)
end end
def all_protocols_enabled? def all_protocols_enabled?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment