diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/models/namespace.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/models/namespace.rb')
-rw-r--r-- | app/models/namespace.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 238e8f70778..6f7b377ee52 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -28,7 +28,7 @@ class Namespace < ApplicationRecord has_many :runner_namespaces, inverse_of: :namespace, class_name: 'Ci::RunnerNamespace' has_many :runners, through: :runner_namespaces, source: :runner, class_name: 'Ci::Runner' - has_many :namespace_onboarding_actions + has_one :onboarding_progress # This should _not_ be `inverse_of: :namespace`, because that would also set # `user.namespace` when this user creates a group with themselves as `owner`. @@ -40,6 +40,7 @@ class Namespace < ApplicationRecord has_one :chat_team, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_one :root_storage_statistics, class_name: 'Namespace::RootStorageStatistics' has_one :aggregation_schedule, class_name: 'Namespace::AggregationSchedule' + has_one :package_setting_relation, inverse_of: :namespace, class_name: 'PackageSetting' validates :owner, presence: true, unless: ->(n) { n.type == "Group" } validates :name, @@ -160,6 +161,10 @@ class Namespace < ApplicationRecord end end + def package_settings + package_setting_relation || build_package_setting_relation + end + def default_branch_protection super || Gitlab::CurrentSettings.default_branch_protection end @@ -438,6 +443,10 @@ class Namespace < ApplicationRecord end end + def root? + !has_parent? + end + private def all_projects_with_pages |