From a2e0472f83b7f3151c4b4ca51472d18258110561 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 15 Apr 2010 06:18:47 -0700 Subject: [PATCH] Only return the members element to the rest client if the item is an album. This makes it consistent to the rest client that collections will have a members element. --- modules/gallery/helpers/item_rest.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php index f52713b82c..36d2ca6211 100644 --- a/modules/gallery/helpers/item_rest.php +++ b/modules/gallery/helpers/item_rest.php @@ -78,16 +78,18 @@ static function get($request) { } $orm->order_by($order_by); - $members = array(); - foreach ($orm->find_all() as $child) { - $members[] = rest::url("item", $child); - } - - return array( + $result = array( "url" => $request->url, "entity" => $item->as_restful_array(), - "members" => $members, "relationships" => rest::relationships("item", $item)); + if ($item->is_album()) { + $result["members"] = array(); + foreach ($orm->find_all() as $child) { + $result["members"][] = rest::url("item", $child); + } + } + + return $result; } static function put($request) {