Class: JoinedGroupsFinder

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

Instance Method Summary collapse

Methods inherited from UnionFinder

#find_union

Constructor Details

#initialize(user) ⇒ JoinedGroupsFinder

Returns a new instance of JoinedGroupsFinder


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

def initialize(user)
  @user = user
end

Instance Method Details

#execute(current_user = nil) ⇒ Object

Finds the groups of the source user, optionally limited to those visible to the current user.


8
9
10
11
12
# File 'app/finders/joined_groups_finder.rb', line 8

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

  find_union(segments, Group).order_id_desc
end