Class: PersonalProjectsFinder

Inherits:
UnionFinder show all
Defined in:
app/finders/personal_projects_finder.rb

Instance Method Summary collapse

Methods inherited from UnionFinder

#find_union

Constructor Details

#initialize(user) ⇒ PersonalProjectsFinder


2
3
4
# File 'app/finders/personal_projects_finder.rb', line 2

def initialize(user)
  @user = user
end

Instance Method Details

#execute(current_user = nil) ⇒ Object

Finds the projects belonging to the user in “@user”, limited to either public projects or projects visible to the given user.

current_user - When given the list of projects is limited to those only

visible by this user.

Returns an ActiveRecord::Relation.


13
14
15
16
17
# File 'app/finders/personal_projects_finder.rb', line 13

def execute(current_user = nil)
  segments = all_projects(current_user)

  find_union(segments, Project).includes(:namespace).order_id_desc
end