Commit af61265d authored by Erick Bajao's avatar Erick Bajao

Lessen complexity of closest_setting method

parent 77c10461
...@@ -2251,10 +2251,7 @@ class Project < ApplicationRecord ...@@ -2251,10 +2251,7 @@ class Project < ApplicationRecord
end end
def closest_setting(name) def closest_setting(name)
setting = read_attribute(name) read_attribute(name) || closest_namespace_setting(name) || app_settings_for(name)
setting ||= closest_namespace_setting(name)
setting ||= Gitlab::CurrentSettings.send(name) # rubocop:disable GitlabSecurity/PublicSend
setting
end end
private private
...@@ -2266,6 +2263,10 @@ class Project < ApplicationRecord ...@@ -2266,6 +2263,10 @@ class Project < ApplicationRecord
.try(name) .try(name)
end end
def app_settings_for(name)
Gitlab::CurrentSettings.send(name) # rubocop:disable GitlabSecurity/PublicSend
end
def merge_requests_allowing_collaboration(source_branch = nil) def merge_requests_allowing_collaboration(source_branch = nil)
relation = source_of_merge_requests.opened.where(allow_collaboration: true) relation = source_of_merge_requests.opened.where(allow_collaboration: true)
relation = relation.where(source_branch: source_branch) if source_branch relation = relation.where(source_branch: source_branch) if source_branch
......
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