Merge branch 'develop' into feature/items-page-in-repository
This commit is contained in:
commit
4fe66a3352
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue