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/protected_branch.rb | |
parent | e6b6fb602889e43e7a8dde760e01d0a3b2147c54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r-- | app/models/protected_branch.rb | 6 |
1 files changed, 5 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 |