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:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 15:07:18 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-11 15:07:18 +0300
commitfc0afaf7da2156e91e615662272811eee56d034a (patch)
treec6199a554acff7bdd34a7b6d7edf673807062212 /app/models/protected_branch.rb
parente6b6fb602889e43e7a8dde760e01d0a3b2147c54 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r--app/models/protected_branch.rb6
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