Welcome to mirror list, hosted at ThFree Co, Russian Federation.

base.rb « groups « finders « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 26d2ad85fd444687ad9a15ee756a2c116726aa61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Groups
  class Base
    private

    def sort(items)
      items.reorder(Group.arel_table[:path].asc, Group.arel_table[:id].asc) # rubocop: disable CodeReuse/ActiveRecord
    end

    def by_search(items, exact_matches_first: false)
      return items if params[:search].blank?

      items.search(params[:search], include_parents: true, exact_matches_first: exact_matches_first)
    end
  end
end