fix Bulk edit API
This commit is contained in:
parent
e6c51ae233
commit
887b74b16f
|
@ -302,7 +302,7 @@ return apply_filters( 'tainacan-admin-i18n', [
|
|||
'label_show_filters' => __( 'Show filters menu', 'tainacan' ),
|
||||
'label_select_all_items' => __( 'Select all items', 'tainacan' ),
|
||||
'label_select_all' => __( 'Select all', 'tainacan' ),
|
||||
'label_untrash_selected_items' => __( 'Remove from trash the selected items', 'tainacan' ),
|
||||
'label_untrash_selected_items' => __( 'Recover from trash', 'tainacan' ),
|
||||
'label_value_not_informed' => __( 'Value not informed.', 'tainacan' ),
|
||||
'label_description_not_informed' => __( 'Description not informed.', 'tainacan' ),
|
||||
|
||||
|
|
|
@ -183,12 +183,12 @@ class REST_Bulkedit_Controller extends REST_Controller {
|
|||
$args['items_ids'] = $body['items_ids'];
|
||||
} elseif ( isset($body['use_query']) && $body['use_query'] ) {
|
||||
|
||||
unset($request['paged']);
|
||||
unset($request['offset']);
|
||||
unset($request['perpage']);
|
||||
$request['nopaging'] = 1;
|
||||
unset($body['use_query']['paged']);
|
||||
unset($body['use_query']['offset']);
|
||||
unset($body['use_query']['perpage']);
|
||||
$body['use_query']['nopaging'] = 1;
|
||||
|
||||
$query_args = $this->prepare_filters($request);
|
||||
$query_args = $this->prepare_filters($body['use_query']);
|
||||
|
||||
$collection_id = $request['collection_id'];
|
||||
|
||||
|
|
|
@ -1272,5 +1272,32 @@ class BulkEdit extends TAINACAN_UnitApiTestCase {
|
|||
|
||||
}
|
||||
|
||||
function test_create_delete_group() {
|
||||
|
||||
$Tainacan_Items = \Tainacan\Repositories\Items::get_instance();
|
||||
|
||||
$ids = array_slice($this->items_ids, 2, 7);
|
||||
|
||||
$bulk = new \Tainacan\Bulk_Edit([
|
||||
'items_ids' => $ids,
|
||||
]);
|
||||
|
||||
$bulk->trash_items();
|
||||
|
||||
$query = [
|
||||
'status' => 'trash',
|
||||
'posts_per_page' => -1
|
||||
];
|
||||
|
||||
$bulk = new \Tainacan\Bulk_Edit([
|
||||
'query' => $query,
|
||||
'collection_id' => $this->collection->get_id()
|
||||
]);
|
||||
|
||||
$this->assertEquals(7, $bulk->count_posts());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue