[CYS] Fix AI generated site title comparison (#46819)

* Fix AI generated site titles comparisons

* Add changefile(s) from automation for the following project(s): woocommerce

* Fix lint errors

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Alba Rincón 2024-04-24 10:49:20 +02:00 committed by GitHub
parent a6fe8ef3ff
commit e20641341d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 14 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
[CYS] Fix the AI-generated site title comparison.

View File

@ -63,21 +63,21 @@ class StoreTitle extends AbstractRoute {
* @return array An array of endpoints.
*/
public function get_args() {
return [
[
return array(
array(
'methods' => \WP_REST_Server::CREATABLE,
'callback' => [ $this, 'get_response' ],
'permission_callback' => [ Middleware::class, 'is_authorized' ],
'args' => [
'business_description' => [
'callback' => array( $this, 'get_response' ),
'permission_callback' => array( Middleware::class, 'is_authorized' ),
'args' => array(
'business_description' => array(
'description' => __( 'The business description for a given store.', 'woocommerce' ),
'type' => 'string',
],
],
],
'schema' => [ $this->schema, 'get_public_item_schema' ],
'allow_batch' => [ 'v1' => true ],
];
),
),
),
'schema' => array( $this->schema, 'get_public_item_schema' ),
'allow_batch' => array( 'v1' => true ),
);
}
/**
@ -100,8 +100,8 @@ class StoreTitle extends AbstractRoute {
);
}
$store_title = get_option( 'blogname' );
$previous_ai_generated_title = get_option( 'ai_generated_site_title' );
$store_title = html_entity_decode( get_option( 'blogname' ) );
$previous_ai_generated_title = html_entity_decode( get_option( 'ai_generated_site_title' ) );
if ( self::DEFAULT_TITLE === $store_title || ( ! empty( $store_title ) && $previous_ai_generated_title !== $store_title ) ) {
return rest_ensure_response( array( 'ai_content_generated' => false ) );