summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-07-06 13:14:47 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-07-06 13:14:47 +0000
commit7ab0cadbbdf42fdd316941b3260e294577d649f4 (patch)
tree26ed9d750eb7706174afddb43a9e6fab210f2176 /app/models
parent3aad3a0b6ffb1a0fe36db41f81e8bbd3728e5f80 (diff)
downloadgitlab-ce-7ab0cadbbdf42fdd316941b3260e294577d649f4.tar.gz
Add latest changes from gitlab-org/gitlab@14-0-stable-ee
Diffstat (limited to 'app/models')
-rw-r--r--app/models/deploy_key.rb1
-rw-r--r--app/models/namespace.rb9
2 files changed, 7 insertions, 3 deletions
diff --git a/app/models/deploy_key.rb b/app/models/deploy_key.rb
index 25e3b9fe4f0..8f5a713af3f 100644
--- a/app/models/deploy_key.rb
+++ b/app/models/deploy_key.rb
@@ -3,6 +3,7 @@
class DeployKey < Key
include FromUnion
include IgnorableColumns
+ include PolicyActor
has_many :deploy_keys_projects, inverse_of: :deploy_key, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :projects, through: :deploy_keys_projects
diff --git a/app/models/namespace.rb b/app/models/namespace.rb
index 90e06e44165..5f41441058b 100644
--- a/app/models/namespace.rb
+++ b/app/models/namespace.rb
@@ -271,9 +271,12 @@ class Namespace < ApplicationRecord
# Includes projects from this namespace and projects from all subgroups
# that belongs to this namespace
def all_projects
- namespace = user? ? self : self_and_descendant_ids
-
- Project.where(namespace: namespace)
+ if Feature.enabled?(:recursive_approach_for_all_projects, default_enabled: :yaml)
+ namespace = user? ? self : self_and_descendants
+ Project.where(namespace: namespace)
+ else
+ Project.inside_path(full_path)
+ end
end
def has_parent?