Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/namespace_setting.rb')
-rw-r--r--app/models/namespace_setting.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb
index 3e6371b0c4d..5081d5cdafe 100644
--- a/app/models/namespace_setting.rb
+++ b/app/models/namespace_setting.rb
@@ -59,6 +59,16 @@ class NamespaceSetting < ApplicationRecord
all_ancestors_allow_diff_preview_in_email?
end
+ def runner_registration_enabled?
+ runner_registration_enabled && all_ancestors_have_runner_registration_enabled?
+ end
+
+ def all_ancestors_have_runner_registration_enabled?
+ return true unless namespace.has_parent?
+
+ !self.class.where(namespace_id: namespace.ancestors, runner_registration_enabled: false).exists?
+ end
+
private
def all_ancestors_allow_diff_preview_in_email?