diff options
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/admin/projects_finder.rb | 8 | ||||
-rw-r--r-- | app/finders/projects_finder.rb | 17 |
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 |