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:
Exclude:
- app/helpers/application_settings_helper.rb
- ee/spec/features/projects/new_project_spec.rb
- ee/spec/finders/template_finder_spec.rb
- ee/spec/helpers/ee/blob_helper_spec.rb
......
......@@ -37,9 +37,15 @@ module ApplicationSettingsHelper
end
def storage_weights
Gitlab.config.repositories.storages.keys.each_with_object(OpenStruct.new) do |storage, weights|
weights[storage.to_sym] = @application_setting.repository_storages_weighted[storage] || 0
# Instead of using a `Struct` we could wrap this into an object.
# 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
weights.new(*values)
end
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