Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
4 changes: 4 additions & 0 deletions packages/js/src/components/Indexation.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ export class Indexation extends Component {
return <Alert type={ "success" }>{ __( "SEO data optimization complete", "wordpress-seo" ) }</Alert>;
}

if ( this.settings.showIndexingCompleteMessage ) {
return <Alert type={ "success" }>{ __( "SEO data is already optimized", "wordpress-seo" ) }</Alert>;
}

return this.renderTool();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/integrations/admin/indexing-tool-integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public function enqueue_scripts() {
'importing_endpoints' => $this->get_importing_endpoints(),
'nonce' => \wp_create_nonce( 'wp_rest' ),
],
'showIndexingCompleteMessage' => ! $this->indexing_helper->should_show_optimization_button(),
Comment thread
hdvos marked this conversation as resolved.
Outdated
];

/**
Expand Down
2 changes: 2 additions & 0 deletions src/presenters/admin/indexing-list-item-presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
use Yoast\WP\SEO\Presenters\Abstract_Presenter;


/**
* Class Indexing_List_Item_Presenter.
*
Expand Down Expand Up @@ -34,6 +35,7 @@ public function __construct( Short_Link_Helper $short_link_helper ) {
* @return string The list item HTML.
*/
public function present() {

$output = \sprintf( '<li><strong>%s</strong><br/>', \esc_html__( 'Optimize SEO Data', 'wordpress-seo' ) );
$output .= \sprintf(
'%1$s <a href="%2$s" target="_blank">%3$s</a>',
Expand Down
15 changes: 11 additions & 4 deletions tests/unit/integrations/admin/indexing-tool-integration-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ public function test_enqueue_scripts() {
->once()
->andReturn( 112 );

$this->indexing_helper
->expects( 'should_show_optimization_button' )
->once()
->andReturnTrue();

$this->asset_manager
->expects( 'enqueue_script' )
->with( 'indexation' );
Expand Down Expand Up @@ -241,10 +246,10 @@ public function test_enqueue_scripts() {
->andReturnTrue();

$injected_data = [
'disabled' => false,
'amount' => 112,
'firstTime' => true,
'restApi' => [
'disabled' => false,
'amount' => 112,
'firstTime' => true,
'restApi' => [
'root' => 'https://example.org/wp-ajax/',
'indexing_endpoints' => [
'prepare' => 'yoast/v1/indexing/prepare',
Expand All @@ -264,6 +269,7 @@ public function test_enqueue_scripts() {
],
'nonce' => 'nonce_value',
],
'showIndexingCompleteMessage' => false,
];

$injected_data['errorMessage'] = '<p>Oops, something has gone wrong and we couldn\'t complete the optimization of your SEO data. ' .
Expand Down Expand Up @@ -294,6 +300,7 @@ public function test_enqueue_scripts() {
Monkey\Filters\expectApplied( 'wpseo_indexing_data' )
->with( $injected_data );


$this->instance->enqueue_scripts();
}

Expand Down