summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-11 17:05:39 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-12 11:36:54 +0200
commit18907efbc9209ee39d8348eef5b3c7321b9aca26 (patch)
treef1b3d0c055d52bcbe7908b2d4abde1c12a3476ad
parent8cde1e3285c870c85bee3a9a9ff4b8e5f53cff86 (diff)
downloadgitlab-ce-18907efbc9209ee39d8348eef5b3c7321b9aca26.tar.gz
Pass `archived:` as a keyword argument
-rw-r--r--app/controllers/concerns/group_tree.rb2
-rw-r--r--app/finders/group_descendants_finder.rb4
-rw-r--r--app/models/concerns/loaded_in_group_list.rb6
-rw-r--r--spec/models/concerns/loaded_in_group_list_spec.rb4
4 files changed, 8 insertions, 8 deletions
diff --git a/app/controllers/concerns/group_tree.rb b/app/controllers/concerns/group_tree.rb
index 71223b59808..9d4f97aa443 100644
--- a/app/controllers/concerns/group_tree.rb
+++ b/app/controllers/concerns/group_tree.rb
@@ -7,7 +7,7 @@ module GroupTree
# Only show root groups if no parent-id is given
groups.where(parent_id: params[:parent_id])
end
- @groups = @groups.with_selects_for_list(params[:archived])
+ @groups = @groups.with_selects_for_list(archived: params[:archived])
.sort(@sort = params[:sort])
.page(params[:page])
diff --git a/app/finders/group_descendants_finder.rb b/app/finders/group_descendants_finder.rb
index 7ceede3a31a..1a5f6063437 100644
--- a/app/finders/group_descendants_finder.rb
+++ b/app/finders/group_descendants_finder.rb
@@ -102,7 +102,7 @@ class GroupDescendantsFinder
projects_to_load_ancestors_of = projects.where.not(namespace: parent_group)
groups_to_load_ancestors_of = Group.where(id: projects_to_load_ancestors_of.select(:namespace_id))
ancestors_for_groups(groups_to_load_ancestors_of)
- .with_selects_for_list(params[:archived])
+ .with_selects_for_list(archived: params[:archived])
end
def subgroups
@@ -115,7 +115,7 @@ class GroupDescendantsFinder
else
direct_child_groups
end
- groups.with_selects_for_list(params[:archived]).order_by(sort)
+ groups.with_selects_for_list(archived: params[:archived]).order_by(sort)
end
def direct_child_projects
diff --git a/app/models/concerns/loaded_in_group_list.rb b/app/models/concerns/loaded_in_group_list.rb
index 8b519d742c5..4c4045fdab2 100644
--- a/app/models/concerns/loaded_in_group_list.rb
+++ b/app/models/concerns/loaded_in_group_list.rb
@@ -24,13 +24,13 @@ module LoadedInGroupList
MEMBER_COUNT_SQL].freeze
module ClassMethods
- def with_counts(archived = nil)
+ def with_counts(archived:)
selects = COUNT_SELECTS.dup << project_count(archived)
select(selects)
end
- def with_selects_for_list(archived = nil)
- with_route.with_counts(archived)
+ def with_selects_for_list(archived: nil)
+ with_route.with_counts(archived: archived)
end
def project_count(archived)
diff --git a/spec/models/concerns/loaded_in_group_list_spec.rb b/spec/models/concerns/loaded_in_group_list_spec.rb
index bf5bfaa76de..7a279547a3a 100644
--- a/spec/models/concerns/loaded_in_group_list_spec.rb
+++ b/spec/models/concerns/loaded_in_group_list_spec.rb
@@ -22,7 +22,7 @@ describe LoadedInGroupList do
create(:project, namespace: parent, archived: true)
create(:project, namespace: parent)
- found_group = Group.with_selects_for_list('true').find_by(id: parent.id)
+ found_group = Group.with_selects_for_list(archived: 'true').find_by(id: parent.id)
expect(found_group.preloaded_project_count).to eq(2)
end
@@ -31,7 +31,7 @@ describe LoadedInGroupList do
create_list(:project, 2, namespace: parent, archived: true)
create(:project, namespace: parent)
- found_group = Group.with_selects_for_list('only').find_by(id: parent.id)
+ found_group = Group.with_selects_for_list(archived: 'only').find_by(id: parent.id)
expect(found_group.preloaded_project_count).to eq(2)
end