<commit_before>class Projects::ProjectMembersController < Projects::ApplicationController
  include MembershipActions

  # Authorize
  before_action :authorize_admin_project_member!, except: [:index, :leave, :request_access]

  def index
    @groups = @project.project_group_links

    members = []
    project_members = @project.project_members
    project_members = project_members.non_invite unless can?(current_user, :admin_project, @project)
    members << project_members.pluck(:id)

    if @project.group
      group_members = @project.group.group_members
      group_members = group_members.non_invite unless can?(current_user, :admin_project, @project)
      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)

    @project_member = @project.project_members.new
  end

  def create
    @project.team.add_users(
      params[:user_ids].split(','),
      params[:access_level],
      expires_at: params[:expires_at],
      current_user: current_user
    )

    redirect_to namespace_project_project_members_path(@project.namespace, @project)
  end

  def update
    @project_member = @project.project_members.find(params[:id])

    return render_403 unless can?(current_user, :update_project_member, @project_member)

    @project_member.update_attributes(member_params)
  end
<commit_msg>Fixed search<commit_after>class Projects::ProjectMembersController < Projects::ApplicationController
  include MembershipActions

  # Authorize
  before_action :authorize_admin_project_member!, except: [:index, :leave, :request_access]

  def index
    @groups = @project.project_group_links

    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)

    @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

    @project_members = @project_members.page(params[:page])

    @requesters = @project.requesters if can?(current_user, :admin_project, @project)

    @project_member = @project.project_members.new
  end

  def create
    @project.team.add_users(
      params[:user_ids].split(','),
      params[:access_level],
      expires_at: params[:expires_at],
      current_user: current_user
    )

    redirect_to namespace_project_project_members_path(@project.namespace, @project)
  end

  def update
    @project_member = @project.project_members.find(params[:id])

    return render_403 unless can?(current_user, :update_project_member, @project_member)

    @project_member.update_attributes(member_params)
  end

{'fraction_non_alphanumeric': 0.10289937464468447, 'fraction_numerical': 0.0017055144968732233, 'mean_word_length': 4.455813953488372, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7585490', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1034, 'n_words': 186}