diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-07-22 11:44:20 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-07-22 11:44:20 +0000 |
commit | 972b5f4555f70fdb47c5b3dc78127377b7220cad (patch) | |
tree | ae8b41fe06336a8cbf31307d5fdbd3a03fd62c01 /app/models/project.rb | |
parent | 5ca1899a5f436cd1a8d0f6938fa1c22c1fd3d1a3 (diff) | |
download | gitlab-ce-972b5f4555f70fdb47c5b3dc78127377b7220cad.tar.gz |
Removed project autocomplete pagination
This pagination is not used anywhere so there is no reason
to keep it. It seems the usage of offset_id was probably
removed in 90c60138db4e1f86026aac5760febe4ba066ca30
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 8dfe2212282..ece7507e55c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -357,6 +357,7 @@ class Project < ApplicationRecord scope :sorted_by_activity, -> { reorder(Arel.sql("GREATEST(COALESCE(last_activity_at, '1970-01-01'), COALESCE(last_repository_updated_at, '1970-01-01')) DESC")) } scope :sorted_by_stars_desc, -> { reorder(star_count: :desc) } scope :sorted_by_stars_asc, -> { reorder(star_count: :asc) } + scope :sorted_by_name_asc_limited, ->(limit) { reorder(name: :asc).limit(limit) } scope :in_namespace, ->(namespace_ids) { where(namespace_id: namespace_ids) } scope :personal, ->(user) { where(namespace_id: user.namespace_id) } @@ -441,22 +442,6 @@ class Project < ApplicationRecord without_deleted.find_by_id(id) end - # Paginates a collection using a `WHERE id < ?` condition. - # - # before - A project ID to use for filtering out projects with an equal or - # greater ID. If no ID is given, all projects are included. - # - # limit - The maximum number of rows to include. - def self.paginate_in_descending_order_using_id( - before: nil, - limit: Kaminari.config.default_per_page - ) - relation = order_id_desc.limit(limit) - relation = relation.where('projects.id < ?', before) if before - - relation - end - def self.eager_load_namespace_and_owner includes(namespace: :owner) end |