Skip to content

Conversation

RaduCristianPopescu
Copy link

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?

Copy link
Contributor

@Copilot Copilot AI left a comment

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.

@pirate-bot
Copy link
Collaborator

pirate-bot commented Sep 19, 2025

Plugin build for eafe7c7 is ready 🛎️!

Comment on lines 2305 to 2321
/**
* 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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants