summaryrefslogtreecommitdiff
path: root/app/finders/packages/packages_finder.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 10:34:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 10:34:06 +0000
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/finders/packages/packages_finder.rb
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
downloadgitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/finders/packages/packages_finder.rb')
-rw-r--r--app/finders/packages/packages_finder.rb21
1 files changed, 3 insertions, 18 deletions
diff --git a/app/finders/packages/packages_finder.rb b/app/finders/packages/packages_finder.rb
index 72a63224d2f..bd9e62e3f2a 100644
--- a/app/finders/packages/packages_finder.rb
+++ b/app/finders/packages/packages_finder.rb
@@ -2,7 +2,7 @@
module Packages
class PackagesFinder
- attr_reader :params, :project
+ include ::Packages::FinderHelper
def initialize(project, params = {})
@project = project
@@ -21,29 +21,14 @@ module Packages
packages = filter_with_version(packages)
packages = filter_by_package_type(packages)
packages = filter_by_package_name(packages)
+ packages = filter_by_status(packages)
packages = order_packages(packages)
packages
end
private
- def filter_with_version(packages)
- return packages if params[:include_versionless].present?
-
- packages.has_version
- end
-
- def filter_by_package_type(packages)
- return packages unless params[:package_type]
-
- packages.with_package_type(params[:package_type])
- end
-
- def filter_by_package_name(packages)
- return packages unless params[:package_name]
-
- packages.search_by_name(params[:package_name])
- end
+ attr_reader :params, :project
def order_packages(packages)
packages.sort_by_attribute("#{params[:order_by]}_#{params[:sort]}")