Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Oct 10, 2023
2 parents 0961829 + e8feac6 commit 36c26ea
Show file tree
Hide file tree
Showing 70 changed files with 727 additions and 553 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ jobs:
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
coverage: none
ini-values: memory_limit=3G

- name: composer install
run: |
cd wp-content/plugins/elasticpress
composer install
- name: Start MySQL
run: |
sudo systemctl start mysql.service
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/wordpress-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "WordPress version checker"
on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
schedule:
- cron: '0 0 * * 1'

jobs:
wordpress-version-checker:
runs-on: ubuntu-latest
steps:
- name: WordPress version checker
uses: skaut/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,35 @@ All notable changes to this project will be documented in this file, per [the Ke
### Security
-->

## [4.7.2] - 2023-10-10

**Note that starting from the ElasticPress 5.0.0 release the `Users` feature will be moved to the [ElasticPress Labs](https://github.com/10up/ElasticPressLabs) plugin. The `Terms` and `Comments` features will remain in ElasticPress but will be available only if enabled via code. Check [our blog post](https://www.elasticpress.io/blog/2023/03/enabling-comments-and-terms-in-elasticpress-5-0) for more info.**

### Added
* New `ep_highlight_number_of_fragments` filter. Props [@dgnorrod](https://github.com/dgnorrod) and [@felipeelia](https://github.com/felipeelia) via [#3681](https://github.com/10up/ElasticPress/pull/3681).
* >=PHP 7.0 version check. Props [@bmarshall511](https://github.com/bmarshall511) and [@felipeelia](https://github.com/felipeelia) via [#3641](https://github.com/10up/ElasticPress/pull/3641).
* GitHub action to automatically open a new issue when a new version of WordPress is released. Props [@felipeelia](https://github.com/felipeelia) via [#3666](https://github.com/10up/ElasticPress/pull/3666).

### Removed
* Unnecessary aliases in use statements. Props [@felipeelia](https://github.com/felipeelia) via [#3671](https://github.com/10up/ElasticPress/pull/3671).

### Fixed
* Calls to `ep_woocommerce_default_supported_post_types` were ignored. Props [@felipeelia](https://github.com/felipeelia) and [@MARQAS](https://github.com/MARQAS) via [#3679](https://github.com/10up/ElasticPress/pull/3679).
* WooCommerce Orders search field disappearing when Orders Autosuggest receives an unexpected response from ElasticPress.io. Props [@JakePT](https://github.com/JakePT) and [@anjulahettige](https://github.com/anjulahettige) via [#3682](https://github.com/10up/ElasticPress/pull/3682).
* Call composer while building docs. Props [@felipeelia](https://github.com/felipeelia) via [#3625](https://github.com/10up/ElasticPress/pull/3625).
* Make sure `post__not_in` and `post_status` are translated into arrays, not objects. Props [@felipeelia](https://github.com/felipeelia) via [#3652](https://github.com/10up/ElasticPress/pull/3652) and [#3680](https://github.com/10up/ElasticPress/pull/3680).
* Updated phpDoc entries. Props [@renatonascalves](https://github.com/renatonascalves) via [#3635](https://github.com/10up/ElasticPress/pull/3635).
* Docblock for `Utils\get_option` return type. Props [@felipeelia](https://github.com/felipeelia) via [#3653](https://github.com/10up/ElasticPress/pull/3653).
* Docblock for `ep_capability` and `ep_network_capability` filters. Props [@burhandodhy](https://github.com/burhandodhy) via [#3685](https://github.com/10up/ElasticPress/pull/3685).
* PHP warning related to the Autosuggest template generation. Props [@felipeelia](https://github.com/felipeelia) via [#3651](https://github.com/10up/ElasticPress/pull/3651).
* WooCommerce unit tests running multiple times. Props [@felipeelia](https://github.com/felipeelia) via [#3656](https://github.com/10up/ElasticPress/pull/3656).
* Display the meta range facet block in versions prior to WP 6.1. Props [@felipeelia](https://github.com/felipeelia) and [@MARQAS](https://github.com/MARQAS) via [#3658](https://github.com/10up/ElasticPress/pull/3658).
* Number of expected arguments for `add_attachment` and `edit_attachment`. Props [@burhandodhy](https://github.com/burhandodhy) via [#3690](https://github.com/10up/ElasticPress/pull/3690).
* Error while running `composer install` on PHP 8. Props [@burhandodhy](https://github.com/burhandodhy) via [#3683](https://github.com/10up/ElasticPress/pull/3683).

### Security
* Bumped `composer/composer` from 2.5.8 to 2.6.4. Props [@dependabot](https://github.com/dependabot) via [#3672](https://github.com/10up/ElasticPress/pull/3672).

## [4.7.1] - 2023-08-31

**Note that starting from the ElasticPress 5.0.0 release the `Users` feature will be moved to the [ElasticPress Labs](https://github.com/10up/ElasticPressLabs) plugin. The `Terms` and `Comments` features will remain in ElasticPress but will be available only if enabled via code. Check [our blog post](https://www.elasticpress.io/blog/2023/03/enabling-comments-and-terms-in-elasticpress-5-0) for more info.**
Expand Down Expand Up @@ -1926,6 +1955,8 @@ This is a bug fix release with some filter additions.
- Initial plugin release

[Unreleased]: https://github.com/10up/ElasticPress/compare/trunk...develop
[4.7.2]: https://github.com/10up/ElasticPress/compare/4.7.1...4.7.2
[4.7.1]: https://github.com/10up/ElasticPress/compare/4.7.0...4.7.1
[4.7.0]: https://github.com/10up/ElasticPress/compare/4.6.1...4.7.0
[4.6.1]: https://github.com/10up/ElasticPress/compare/4.6.0...4.6.1
[4.6.0]: https://github.com/10up/ElasticPress/compare/4.5.2...4.6.0
Expand Down
3 changes: 3 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ Thank you to all the people who have already contributed to this repository via
[xxx (@wildberrylillet)](https://github.com/wildberrylillet)
[@tomi10up](https://github.com/tomi10up)
[Junaid Bhura (@junaidbhura)](https://github.com/junaidbhura)
[Renato Alves (@renatonascalves)](https://github.com/renatonascalves)
[Ben Marshall (@bmarshall511)](https://github.com/bmarshall511)
[@dgnorrod](https://github.com/dgnorrod)
and
[@qazaqstan2025](https://github.com/qazaqstan2025).

Expand Down
20 changes: 16 additions & 4 deletions assets/js/api-search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
useRef,
WPElement,
} from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies.
Expand Down Expand Up @@ -298,13 +299,24 @@ export const ApiSearchProvider = ({

setIsLoading(true);

const response = await fetchResults(urlParams);
try {
const response = await fetchResults(urlParams);

if (!response) {
return;
if (!response) {
return;
}

setResults(response);
} catch (e) {
const errorMessage = sprintf(
/* translators: Error message */
__('ElasticPress: Unable to fetch results. %s', 'elasticpress'),
e.message,
);

console.error(errorMessage); // eslint-disable-line no-console
}

setResults(response);
setIsLoading(false);
};

Expand Down
14 changes: 11 additions & 3 deletions assets/js/api-search/src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* WordPress dependencies.
*/
import { useCallback, useRef } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies.
Expand Down Expand Up @@ -47,6 +48,7 @@ export const useFetchResults = (
};

const requestId = generateRequestId(requestIdBase);

if (requestId) {
headers['X-ElasticPress-Request-ID'] = requestId;
}
Expand All @@ -56,14 +58,20 @@ export const useFetchResults = (
headers,
})
.then((response) => {
if (onAuthErrorRef.current && !response.ok) {
onAuthErrorRef.current();
if (!response.ok) {
if (response.status === 401 && onAuthErrorRef.current) {
onAuthErrorRef.current();
return '';
}

/* translators: Response status code */
throw new Error(sprintf(__('HTTP %d.', 'elasticpress'), response.status));
}

return response.json();
})
.catch((error) => {
if (error?.name !== 'AbortError' && !request.current) {
if (error?.name !== 'AbortError') {
throw error;
}
})
Expand Down
Loading

0 comments on commit 36c26ea

Please sign in to comment.