From ad58dec2e1564e9c2d23dd32e5da8b12eeba965d Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Fri, 23 Dec 2016 16:29:00 -0600 Subject: Added groups to members section, added a members finder --- app/finders/members_finder.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/finders/members_finder.rb (limited to 'app/finders') diff --git a/app/finders/members_finder.rb b/app/finders/members_finder.rb new file mode 100644 index 00000000000..b476b0bc184 --- /dev/null +++ b/app/finders/members_finder.rb @@ -0,0 +1,13 @@ +class MembersFinder < Projects::ApplicationController + def initialize(project_members, group) + @project_members = project_members + @group = group + end + + def execute + non_null_user_ids = @project_members.where.not(user_id: nil).select(:user_id) + group_members = @group.group_members.where.not(user_id: non_null_user_ids) + group_members = group_members.non_invite unless can?(current_user, :admin_group, @group) + group_members + end +end -- cgit v1.2.1