Class: JoinedGroupsFinder

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

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ JoinedGroupsFinder

Returns a new instance of JoinedGroupsFinder.


4
5
6
# File 'app/finders/joined_groups_finder.rb', line 4

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.


10
11
12
13
14
# File 'app/finders/joined_groups_finder.rb', line 10

def execute(current_user = nil)
  @user.authorized_groups
    .public_or_visible_to_user(current_user)
    .order_id_desc
end