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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMehdi Lahmam <mehdi@lahmam.com>2017-08-11 12:09:17 +0300
committerMehdi Lahmam <mehdi@lahmam.com>2017-08-24 11:11:07 +0300
commit55f4ddad2b765f3b7466af5b43ef319a330c9fcd (patch)
treebc8887523b41d3014efcaf0736ba33729cb6e1bb /app/finders
parentd184f27ed387c1a90a9f06f68eab801ec3bd89e3 (diff)
Add an option to list only archived projects
Closes #35994
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/admin/projects_finder.rb8
-rw-r--r--app/finders/projects_finder.rb17
2 files changed, 20 insertions, 5 deletions
diff --git a/app/finders/admin/projects_finder.rb b/app/finders/admin/projects_finder.rb
index eac35ae0281..d6bcd939522 100644
--- a/app/finders/admin/projects_finder.rb
+++ b/app/finders/admin/projects_finder.rb
@@ -43,7 +43,13 @@ class Admin::ProjectsFinder
end
def by_archived(items)
- items.non_archived unless params[:archived].present?
+ if params[:archived] == 'only'
+ items.archived
+ elsif params[:archived].blank?
+ items.non_archived
+ else
+ items
+ end
end
def by_personal(items)
diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb
index aa80dfc3f37..fa6fea2588a 100644
--- a/app/finders/projects_finder.rb
+++ b/app/finders/projects_finder.rb
@@ -125,9 +125,18 @@ class ProjectsFinder < UnionFinder
end
def by_archived(projects)
- # Back-compatibility with the places where `params[:archived]` can be set explicitly to `false`
- params[:non_archived] = !Gitlab::Utils.to_boolean(params[:archived]) if params.key?(:archived)
-
- params[:non_archived] ? projects.non_archived : projects
+ if params[:non_archived]
+ projects.non_archived
+ elsif params.key?(:archived) # Back-compatibility with the places where `params[:archived]` can be set explicitly to `false`
+ if params[:archived] == 'only'
+ projects.archived
+ elsif Gitlab::Utils.to_boolean(params[:archived])
+ projects
+ else
+ projects.non_archived
+ end
+ else
+ projects
+ end
end
end