Skip to content

Commit

Permalink
Change REST query param "types" back to "type" (should've never chang…
Browse files Browse the repository at this point in the history
…ed... oops)
  • Loading branch information
shadlaws committed Jun 13, 2013
1 parent 8cfd4d2 commit 4356331
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions modules/gallery/classes/Gallery/Controller/Rest/Item.php
Expand Up @@ -276,8 +276,8 @@ public static function get_members($id, $params) {
->limit(Arr::get($params, "num", static::$default_params["num"]))
->offset(Arr::get($params, "start", static::$default_params["start"]));

if (isset($params["types"])) {
$members->where("type", "IN", $params["types"]);
if (isset($params["type"])) {
$members->where("type", "IN", $params["type"]);
}

if (isset($params["name"])) {
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/classes/Gallery/Controller/Rest/Items.php
Expand Up @@ -54,7 +54,7 @@ class Gallery_Controller_Rest_Items extends Controller_Rest {
* @see Controller_Rest_Item::get_members().
*/
public static function get_members($id, $params) {
$types = Arr::get($params, "types");
$types = Arr::get($params, "type");
$name = Arr::get($params, "name");

$data = array();
Expand Down
8 changes: 4 additions & 4 deletions modules/gallery/classes/Gallery/Controller/Rest/Tree.php
Expand Up @@ -60,8 +60,8 @@ static function get_entity($id, $params) {
$members->where("level", "<=", $item->level + $params["depth"]);
}

if (isset($params["types"])) {
$members->where("type", "IN", $params["types"]);
if (isset($params["type"])) {
$members->where("type", "IN", $params["type"]);
}

$members = $members->viewable()->find_all();
Expand Down Expand Up @@ -109,8 +109,8 @@ static function get_members($id, $params) {
return array();
}

if (isset($params["types"])) {
$members->where("type", "IN", $params["types"]);
if (isset($params["type"])) {
$members->where("type", "IN", $params["type"]);
}

$members = $members->viewable()->find_all();
Expand Down
8 changes: 4 additions & 4 deletions modules/rest/classes/Rest/Controller/Rest.php
Expand Up @@ -111,14 +111,14 @@ public function before() {
// Process some additional fields, depending on the method.
switch ($method) {
case HTTP_Request::GET:
// Process the "types" list, if specified.
if ($types = $this->request->query("types")) {
// Process the "type" list, if specified.
if ($types = $this->request->query("type")) {
$types = explode(",", trim($types, ","));
// If one or more of the types is invalid, fire a 400 Bad Request.
if (array_diff($types, array("album", "photo", "movie"))) {
throw Rest_Exception::factory(400, array("types" => "invalid"));
throw Rest_Exception::factory(400, array("type" => "invalid"));
}
$this->request->query("types", $types);
$this->request->query("type", $types);
}
break;

Expand Down
2 changes: 1 addition & 1 deletion modules/search/classes/Search/Controller/Rest/Search.php
Expand Up @@ -66,7 +66,7 @@ static function get_members($id, $params) {

// Build the members array.
$data = array();
$types = Arr::get($params, "types");
$types = Arr::get($params, "type");
foreach ($result[1] as $item) {
if (!$types || in_array($item->type, $types)) {
$data[] = array("item", $item->id);
Expand Down
4 changes: 2 additions & 2 deletions modules/tag/classes/Tag/Controller/Rest/TagItems.php
Expand Up @@ -65,8 +65,8 @@ static function get_members($id, $params) {
->limit(Arr::get($params, "num", static::$default_params["num"]))
->offset(Arr::get($params, "start", static::$default_params["start"]));

if (isset($params["types"])) {
$members->where("type", "IN", $params["types"]);
if (isset($params["type"])) {
$members->where("type", "IN", $params["type"]);
}

if (isset($params["name"])) {
Expand Down

0 comments on commit 4356331

Please sign in to comment.