Class: ContributedProjectsFinder

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

Instance Method Summary collapse

Methods inherited from UnionFinder

#find_union

Constructor Details

#initialize(user) ⇒ ContributedProjectsFinder


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

def initialize(user)
  @user = user
end

Instance Method Details

#execute(current_user = nil) ⇒ Object

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

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

visible by this user.

Returns an ActiveRecord::Relation.


13
14
15
16
17
# File 'app/finders/contributed_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