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:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-13 16:13:52 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-13 16:15:45 +0300
commit4d79159973d7b51230ceb9efd33bb1cbb191621b (patch)
tree2e8d8b8d9a57e63ed1cbe43e348224aa611b610e /app/serializers
parenta1bfdf76f25c273fa7e4a694d4934e7f4585d8d7 (diff)
Make sure we always return an array of hierarchies
Even when we pass an array of only a single object
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/group_child_serializer.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/serializers/group_child_serializer.rb b/app/serializers/group_child_serializer.rb
index 6d0e67a37cd..2baef0a5703 100644
--- a/app/serializers/group_child_serializer.rb
+++ b/app/serializers/group_child_serializer.rb
@@ -28,7 +28,9 @@ class GroupChildSerializer < BaseSerializer
represent_hierarchy(children.hierarchy(hierarchy_root), opts).first
else
hierarchies = GroupDescendant.build_hierarchy(children, hierarchy_root)
- represent_hierarchy(hierarchies, opts)
+ # When an array was passed, we always want to represent an array.
+ # Even if the hierarchy only contains one element
+ represent_hierarchy(Array.wrap(hierarchies), opts)
end
end