Fixed search

This commit is contained in:
Phil Hughes 2016-09-02 10:52:17 +01:00
parent 3e19f1976f
commit 931d09f481

View file

@ -10,21 +10,30 @@ class Projects::ProjectMembersController < Projects::ApplicationController
members = []
project_members = @project.project_members
project_members = project_members.non_invite unless can?(current_user, :admin_project, @project)
if params[:search].present?
users = @project.users.search(params[:search]).to_a
project_members = project_members.where(user_id: users)
end
members << project_members.pluck(:id)
if @project.group
group_members = @project.group.group_members
@group = @project.group
if @group
group_members = @group.group_members
group_members = group_members.non_invite unless can?(current_user, :admin_project, @project)
if params[:search].present?
users = @group.users.search(params[:search]).to_a
group_members = group_members.where(user_id: users)
end
members << group_members.pluck(:id)
end
@project_members = Member.where(id: members)
@project_members_size = @project_members.size
if params[:search].present?
@project_members = @project_members.search(params[:search])
end
@project_members = @project_members.page(params[:page])
@requesters = @project.requesters if can?(current_user, :admin_project, @project)