Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Remove authors filter from Product Collection block #11427

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion assets/js/blocks/product-collection/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const DEFAULT_QUERY: ProductCollectionQuery = {
postType: 'product',
order: 'asc',
orderBy: 'title',
author: '',
search: '',
exclude: [],
inherit: null,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import KeywordControl from './keyword-control';
import AttributesControl from './attributes-control';
import TaxonomyControls from './taxonomy-controls';
import HandPickedProductsControl from './hand-picked-products-control';
import AuthorControl from './author-control';
import LayoutOptionsControl from './layout-options-control';

const ProductCollectionInspectorControls = (
Expand Down Expand Up @@ -99,7 +98,6 @@ const ProductCollectionInspectorControls = (
<KeywordControl { ...queryControlProps } />
<AttributesControl { ...queryControlProps } />
<TaxonomyControls { ...queryControlProps } />
<AuthorControl { ...queryControlProps } />
</ToolsPanel>
) : null }
<ProductCollectionFeedbackPrompt />
Expand Down
1 change: 0 additions & 1 deletion assets/js/blocks/product-collection/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export interface ProductCollectionDisplayLayout {
}

export interface ProductCollectionQuery {
author: string;
exclude: string[];
inherit: boolean | null;
offset: number;
Expand Down
5 changes: 0 additions & 5 deletions assets/js/blocks/product-template/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { __ } from '@wordpress/i18n';
import {
BlockContextProvider,
__experimentalUseBlockPreview as useBlockPreview,

Check warning on line 11 in assets/js/blocks/product-template/edit.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

assets/js/blocks/product-template/edit.tsx#L11

[@wordpress/no-unsafe-wp-apis] Usage of `__experimentalUseBlockPreview` from `@wordpress/block-editor` is not allowed. See https://developer.wordpress.org/block-editor/contributors/develop/coding-guidelines/#experimental-and-unstable-apis for details.
useBlockProps,
useInnerBlocksProps,
store as blockEditorStore,
Expand Down Expand Up @@ -77,7 +77,6 @@
offset = 0,
order,
orderBy,
author,
search,
exclude,
inherit,
Expand Down Expand Up @@ -155,9 +154,6 @@
if ( perPage ) {
query.per_page = perPage;
}
if ( author ) {
query.author = author;
}
if ( search ) {
query.search = search;
}
Expand Down Expand Up @@ -186,7 +182,6 @@
order,
orderBy,
clientId,
author,
search,
postType,
exclude,
Expand Down
5 changes: 3 additions & 2 deletions src/BlockTypes/ProductCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ public function update_rest_query_in_editor( $args, $request ): array {
$stock_status = $request->get_param( 'woocommerceStockStatus' );
$product_attributes = $request->get_param( 'woocommerceAttributes' );
$handpicked_products = $request->get_param( 'woocommerceHandPickedProducts' );
$args['author'] = $request->get_param( 'author' ) ?? '';
// This argument is required for the tests to PHP Unit Tests to run correctly.
// Most likely this argument is being accessed in the test environment image.
$args['author'] = '';

return $this->get_final_query_args(
$args,
Expand Down Expand Up @@ -297,7 +299,6 @@ private function get_final_frontend_query( $query, $page = 1, $is_exclude_applie
'tax_query' => array(),
'paged' => $page,
's' => $query['search'],
'author' => $query['author'] ?? '',
);

$is_on_sale = $query['woocommerceOnSale'] ?? false;
Expand Down
1 change: 0 additions & 1 deletion tests/php/BlockTypes/ProductCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private function get_base_parsed_block() {
'postType' => 'product',
'order' => 'desc',
'orderBy' => 'date',
'author' => '',
'search' => '',
'exclude' => array(),
'sticky' => '',
Expand Down
Loading