2018-09-11 15:08:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-07 08:29:19 -04:00
|
|
|
class JoinedGroupsFinder
|
2016-03-16 18:44:33 -04:00
|
|
|
def initialize(user)
|
2016-03-08 19:01:33 -05:00
|
|
|
@user = user
|
|
|
|
end
|
|
|
|
|
|
|
|
# Finds the groups of the source user, optionally limited to those visible to
|
|
|
|
# the current user.
|
|
|
|
def execute(current_user = nil)
|
2018-09-07 08:29:19 -04:00
|
|
|
@user.authorized_groups
|
|
|
|
.public_or_visible_to_user(current_user)
|
|
|
|
.order_id_desc
|
2016-03-08 19:01:33 -05:00
|
|
|
end
|
|
|
|
end
|