summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-08 12:06:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-08 12:06:01 +0000
commit9865665cb15a1f63e6c4d0623d33b8ef11810f8d (patch)
tree25458d0f21cf25896af750ed6933bbc4efcdb909 /app/models/project.rb
parent77a7772c3bdb03d92cbc154f6b1a762953cc7c19 (diff)
downloadgitlab-ce-9865665cb15a1f63e6c4d0623d33b8ef11810f8d.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 6b8067ddd7d..29fe9aad62a 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2250,8 +2250,23 @@ class Project < ApplicationRecord
Pages::LookupPath.new(self, trim_prefix: trim_prefix, domain: domain)
end
+ def closest_setting(name)
+ setting = read_attribute(name)
+ setting = closest_namespace_setting(name) if setting.nil?
+ setting = app_settings_for(name) if setting.nil?
+ setting
+ end
+
private
+ def closest_namespace_setting(name)
+ namespace.closest_setting(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