Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6526 LCP/ATF messages that is not working correctly #6562

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
4 changes: 2 additions & 2 deletions assets/js/wpr-admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/wpr-admin.js.min.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/wpr-admin.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inc/Engine/Optimization/RUCSS/Admin/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,12 @@ public function maybe_set_processing_transient( $old_value, $value ) {
*/
private function set_notice_transient() {
set_transient(
'rocket_rucss_processing',
'rocket_saas_processing',
time() + 90,
1.5 * MINUTE_IN_SECONDS
);

rocket_renew_box( 'rucss_success_notice' );
rocket_renew_box( 'saas_success_notice' );
}

/**
Expand Down
14 changes: 9 additions & 5 deletions inc/Engine/Saas/Admin/Notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function display_processing_notice() {

$message = sprintf(
// translators: %1$s = plugin name, %2$s = number of seconds.
__( '%1$s: Please wait %2$s seconds. The Remove Unused CSS service is processing your pages.', 'rocket' ),
__( '%1$s: Please wait %2$s seconds. The Remove Unused CSS service is processing your pages, the plugin is optimizing LCP and the images above the fold.', 'rocket' ),
'<strong>WP Rocket</strong>',
'<span id="rocket-rucss-timer">' . $remaining . '</span>'
);
Expand Down Expand Up @@ -138,13 +138,17 @@ public function display_success_notice() {
$transient = get_transient( 'rocket_saas_processing' );
$class = '';

if ( false !== $transient ) {
if ( false !== $transient || ( ! $this->options->get( 'remove_unused_css', 0 ) ) ) {
$class = 'hidden';
}

$message = sprintf(
// translators: %1$s = plugin name, %2$s = number of URLs, %3$s = number of seconds.
__( '%1$s: The Used CSS of your homepage has been processed. WP Rocket will continue to generate Used CSS for up to %2$s URLs per %3$s second(s).', 'rocket' ),
__(
'%1$s: The LCP element has been optimized, and the images above the fold were excluded from lazyload. The Used CSS of your homepage has been processed.
WP Rocket will continue to generate Used CSS for up to %2$s URLs per %3$s second(s).',
'rocket'
),
'<strong>WP Rocket</strong>',
apply_filters( 'rocket_rucss_pending_jobs_cron_rows_count', 100 ),
apply_filters( 'rocket_rucss_pending_jobs_cron_interval', MINUTE_IN_SECONDS )
Expand Down Expand Up @@ -285,7 +289,7 @@ public function display_saas_error_notice() {

$main_message = sprintf(
// translators: %1$s = <a> open tag, %2$s = </a> closing tag.
__( 'It seems a security plugin or the server\'s firewall prevents WP Rocket from accessing the Remove Unused CSS generator. IPs listed %1$shere in our documentation%2$s should be added to your allowlists:', 'rocket' ),
__( 'It seems a security plugin or the server\'s firewall prevents WP Rocket from accessing the SaaS features. IPs listed %1$shere in our documentation%2$s should be added to your allowlists:', 'rocket' ),
'<a href="' . esc_url( $firewall_beacon['url'] ) . '" data-beacon-article="' . esc_attr( $firewall_beacon['id'] ) . '" rel="noopener noreferrer" target="_blank">',
'</a>'
);
Expand All @@ -301,7 +305,7 @@ public function display_saas_error_notice() {
'message' => $message,
'dismissible' => '',
'id' => 'rocket-notice-rucss-error-http',
'dismiss_button' => 'rucss_error_notice',
'dismiss_button' => 'saas_error_notice',
'dismiss_button_class' => 'button-primary',
]
);
Expand Down
2 changes: 1 addition & 1 deletion inc/Engine/WPRocketUninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class WPRocketUninstall {
'wp_rocket_rucss_errors_count',
'wpr_dynamic_lists_incompatible_plugins',
'rocket_divi_notice',
'rocket_rucss_processing',
'rocket_saas_processing',
'rocket_mod_pagespeed_enabled',
'wp_rocket_pricing',
'wp_rocket_pricing_timeout',
Expand Down
4 changes: 2 additions & 2 deletions src/js/global/countdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function initializeClock(id, endtime) {

function rucssTimer(id, endtime) {
const timer = document.getElementById(id);
const notice = document.getElementById('rocket-notice-rucss-processing');
const success = document.getElementById('rocket-notice-rucss-success');
const notice = document.getElementById('rocket-notice-saas-processing');
const success = document.getElementById('rocket-notice-saas-success');

if (timer === null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public function testShouldDoExpected( $input ) {
Functions\expect( 'set_transient' )
->once()
->with(
'rocket_rucss_processing',
'rocket_saas_processing',
Mockery::type( 'int' ),
90
);

Functions\expect( 'rocket_renew_box' )
->once()
->with( 'rucss_success_notice' );
->with( 'saas_success_notice' );
} else {
$this->database
->shouldReceive( 'truncate_used_css_table' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public function testShouldDoExpected( $input, $expected ) {
Functions\expect( 'set_transient' )
->once()
->with(
'rocket_rucss_processing',
'rocket_saas_processing',
Mockery::type( 'int' ),
90
);

Functions\expect( 'rocket_renew_box' )
->once()
->with( 'rucss_success_notice' );
->with( 'saas_success_notice' );
} else {
Functions\expect( 'set_transient' )->never();
Functions\expect( 'rocket_renew_box' )->never();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ protected function configureDeleteUsedCssRow($config) {
}
Actions\expectDone('rocket_after_clean_used_css');

Functions\expect('set_transient')->with('rocket_rucss_processing', time() + 90, 1.5 * MINUTE_IN_SECONDS);
Functions\expect('set_transient')->with('rocket_saas_processing', time() + 90, 1.5 * MINUTE_IN_SECONDS);

Functions\expect('rocket_renew_box')->with('rucss_success_notice');
Functions\expect('rocket_renew_box')->with('saas_success_notice');
}
}
Loading