Skip to content

ProjectsFinder should handle more options

Similarly to what's done in IssuableFinder, ProjectsFinder should handle more options, like:

  • sort
  • visibility_level
  • tags
  • state
  • personal

Because this code from Explore::ProjectsController#index is ridiculous:

    @projects = ProjectsFinder.new.execute(current_user)
    @tags = @projects.tags_on(:tags)
    @projects = @projects.tagged_with(params[:tag]) if params[:tag].present?
    @projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
    @projects = filter_projects(@projects)
    @projects = @projects.sort(@sort = params[:sort])
    @projects = @projects.includes(:namespace).page(params[:page])