summaryrefslogtreecommitdiff
path: root/app/models/members/project_member.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2018-11-16 16:09:32 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2019-01-31 16:52:50 +0100
commitc653921b6f5b1d8b17fa33aa194117ea9446bf28 (patch)
tree9a57ea8157c19f7dc304e690ace12807beae48da /app/models/members/project_member.rb
parent645f7ee86b138de29245264fea32057bb6060a93 (diff)
downloadgitlab-ce-c653921b6f5b1d8b17fa33aa194117ea9446bf28.tar.gz
Add subresources removal to member destroy service
Diffstat (limited to 'app/models/members/project_member.rb')
-rw-r--r--app/models/members/project_member.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb
index 016c18ce6c8..5372c6084f4 100644
--- a/app/models/members/project_member.rb
+++ b/app/models/members/project_member.rb
@@ -12,6 +12,10 @@ class ProjectMember < Member
default_scope { where(source_type: SOURCE_TYPE) }
scope :in_project, ->(project) { where(source_id: project.id) }
+ scope :in_namespaces, ->(groups) do
+ joins('INNER JOIN projects ON projects.id = members.source_id')
+ .where('projects.namespace_id in (?)', groups.select(:id))
+ end
class << self
# Add users to projects with passed access option