2016-12-23 22:29:00 +00:00
|
|
|
class MembersFinder < Projects::ApplicationController
|
2016-12-26 16:12:24 +00:00
|
|
|
def initialize(project_members, project_group)
|
2016-12-23 22:29:00 +00:00
|
|
|
@project_members = project_members
|
2016-12-26 16:12:24 +00:00
|
|
|
@project_group = project_group
|
2016-12-23 22:29:00 +00:00
|
|
|
end
|
|
|
|
|
2016-12-26 16:12:24 +00:00
|
|
|
def execute(current_user)
|
2016-12-23 22:29:00 +00:00
|
|
|
non_null_user_ids = @project_members.where.not(user_id: nil).select(:user_id)
|
2016-12-26 16:12:24 +00:00
|
|
|
group_members = @project_group.group_members.where.not(user_id: non_null_user_ids)
|
|
|
|
group_members = group_members.non_invite unless can?(current_user, :admin_group, @project_group)
|
2016-12-23 22:29:00 +00:00
|
|
|
group_members
|
|
|
|
end
|
|
|
|
end
|