Skip to content

feat: added compatibility notices for lazy loading#964

Merged
selul merged 12 commits into
developmentfrom
feat/compability_notices
Sep 30, 2025
Merged

feat: added compatibility notices for lazy loading#964
selul merged 12 commits into
developmentfrom
feat/compability_notices

Conversation

@RaduCristianPopescu

Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Now, if there are any conflicts with other plugins, it will display a red label near Optimole's icon.

CleanShot 2025-09-19 at 15 15 23@2x CleanShot 2025-09-19 at 15 15 43@2x

Closes https://github.com/Codeinwp/optimole-service/issues/1526

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds admin UI indicators and clearer conflict notices when other plugins provide overlapping lazy loading functionality. Key changes include: updated translated conflict messages for WP Rocket and Jetpack, added an admin menu badge showing the number of active conflicts, and refactored the conflict item UI styling in the dashboard.

  • Added conflict count badge to the admin menu icon.
  • Rewrote conflict messages for clarity and consistency.
  • Updated conflict item component styling to WordPress-like notice style.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
inc/conflicts/wprocket.php Updated i18n message for WP Rocket lazy load conflict.
inc/conflicts/jetpack_lazyload.php Updated i18n message for Jetpack lazy load conflict.
inc/admin.php Added conflict count badge logic and helper method.
assets/src/dashboard/parts/connected/conflicts/ConflictItem.js Replaced severity-based background classes with styled notice box and adjusted dismissal button styling.
Comments suppressed due to low confidence (1)

inc/conflicts/wprocket.php:1

  • Translator comment lists two placeholders (1 and 2), but the string only contains %1$s and only one argument is passed. Update the comment to reflect a single placeholder (the settings link) to avoid confusing translators.
<?php

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread inc/admin.php Outdated
@pirate-bot

pirate-bot commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator

Plugin build for eafe7c7 is ready 🛎️!

Comment thread inc/admin.php
Comment on lines +2305 to +2330
/**
* Get the number of active notices (not dismissed).
*
* @return int - Number of active notices
*/
private function get_active_notices_count() {
$conflicting_plugins = $this->conflicting_plugins->get_conflicting_plugins();

foreach ( $conflicting_plugins as $key => $plugin ) {
$class_name = 'Optml_' . ucfirst( $key );

if ( class_exists( $class_name ) ) {
try {
$conflict_instance = new $class_name();

if ( method_exists( $conflict_instance, 'is_conflict_valid' ) && ! $conflict_instance->is_conflict_valid() ) {
unset( $conflicting_plugins[ $key ] );
}
} catch ( Exception $e ) {
unset( $conflicting_plugins[ $key ] );
}
}
}

return count( $conflicting_plugins );
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can simplify it with something like this:

<?php
/**
 * Get the number of active notices (not dismissed).
 *
 * @return int - Number of active notices
 */
private function get_active_notices_count() {
    $conflicting_plugins = $this->conflicting_plugins->get_conflicting_plugins();
    $conflicts_count = 0;

    foreach ( $conflicting_plugins as $key => $plugin ) {
        $class_name = 'Optml_' . ucfirst( $key );

        if ( ! class_exists( $class_name ) ) {
            continue;
        }

        $conflict_instance = new $class_name();

        if ( ! is_a( $conflict_instance, 'Optml_Abstract_Conflict' ) ) {
            continue;
        }

        if ( $conflict_instance->is_conflict_valid() ) {
            $conflicts_count++;
        }
    }

    return $conflicts_count;
}

@selul selul merged commit 8bfc444 into development Sep 30, 2025
11 of 12 checks passed
@selul selul deleted the feat/compability_notices branch September 30, 2025 13:56
@pirate-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 4.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants