Merge branch 'develop' into feature/items-page-in-repository

This commit is contained in:
weryques 2018-05-23 13:27:08 -03:00
commit 4fe66a3352
2 changed files with 17 additions and 2 deletions

View File

@ -171,9 +171,20 @@ class REST_Collections_Controller extends REST_Controller {
unset($item_arr['moderators_ids']);
} else {
$attributes_to_filter = $request['fetch_only'];
$attributes_to_filter = $request['fetch_only'];
$item_arr = $this->filter_object_by_attributes($item, $attributes_to_filter);
# Always returns id
if(is_array($attributes_to_filter)) {
$attributes_to_filter[] = 'id';
} else {
$attributes_to_filter = array($attributes_to_filter, 'id');
}
$item_arr = $this->filter_object_by_attributes($item, $attributes_to_filter);
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
}
}
return $item_arr;

View File

@ -175,6 +175,10 @@ class REST_Items_Controller extends REST_Controller {
$item_arr = $this->add_metadata_to_item($item, $item_arr, $args);
}
if ( $request['context'] === 'edit' ) {
$item_arr['current_user_can_edit'] = $item->can_edit();
}
return $item_arr;
}