diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-11 15:07:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-11 15:07:18 +0300 |
commit | fc0afaf7da2156e91e615662272811eee56d034a (patch) | |
tree | c6199a554acff7bdd34a7b6d7edf673807062212 /app/models | |
parent | e6b6fb602889e43e7a8dde760e01d0a3b2147c54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/protected_branch.rb | 6 | ||||
-rw-r--r-- | app/models/protected_branch/merge_access_level.rb | 1 | ||||
-rw-r--r-- | app/models/protected_branch/push_access_level.rb | 1 | ||||
-rw-r--r-- | app/models/protected_tag/create_access_level.rb | 1 |
4 files changed, 8 insertions, 1 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 1753b2a0220..050db3b6870 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -104,6 +104,10 @@ class ProtectedBranch < ApplicationRecord name == project.default_branch end + def entity + group || project + end + private def validate_either_project_or_top_group @@ -111,7 +115,7 @@ class ProtectedBranch < ApplicationRecord errors.add(:base, _('must be associated with a Group or a Project')) elsif project && group errors.add(:base, _('cannot be associated with both a Group and a Project')) - elsif group && group.root_ancestor != group + elsif group && group.subgroup? errors.add(:base, _('cannot be associated with a subgroup')) end end diff --git a/app/models/protected_branch/merge_access_level.rb b/app/models/protected_branch/merge_access_level.rb index df75c557717..76e620aa3bf 100644 --- a/app/models/protected_branch/merge_access_level.rb +++ b/app/models/protected_branch/merge_access_level.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class ProtectedBranch::MergeAccessLevel < ApplicationRecord + include Importable include ProtectedBranchAccess # default value for the access_level column GITLAB_DEFAULT_ACCESS_LEVEL = Gitlab::Access::MAINTAINER diff --git a/app/models/protected_branch/push_access_level.rb b/app/models/protected_branch/push_access_level.rb index 6076fab20b7..66fe57be25f 100644 --- a/app/models/protected_branch/push_access_level.rb +++ b/app/models/protected_branch/push_access_level.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class ProtectedBranch::PushAccessLevel < ApplicationRecord + include Importable include ProtectedBranchAccess # default value for the access_level column GITLAB_DEFAULT_ACCESS_LEVEL = Gitlab::Access::MAINTAINER diff --git a/app/models/protected_tag/create_access_level.rb b/app/models/protected_tag/create_access_level.rb index 9fcfa7646a2..5d8b1fb4f71 100644 --- a/app/models/protected_tag/create_access_level.rb +++ b/app/models/protected_tag/create_access_level.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class ProtectedTag::CreateAccessLevel < ApplicationRecord + include Importable include ProtectedTagAccess def check_access(user) |