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