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: hide duplicate notices if all was dismissed #3630

Merged
merged 1 commit into from
Dec 13, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ public static function display_admin_notice(): void {
return;
}
$dismissed_duplicates = get_option( self::DISMISSED_DUPLICATES_OPTION_NAME, [] );

$orders_to_display = array_filter(
$existing_order_duplicates,
function( $order_duplicates ) use ( $dismissed_duplicates ) {
return ! in_array( $order_duplicates['ids'], $dismissed_duplicates );
}
);

if ( empty( $orders_to_display ) ) {
return;
}
?>
<div class="notice notice-info is-dismissible">
<!-- Admin notice added by newspack-plugin -->
Expand All @@ -158,11 +169,7 @@ public static function display_admin_notice(): void {
<?php echo esc_html__( 'There are some potentially duplicate transactions to review. Some of these might be intentional. Click this message to display the list of possible duplicates.', 'newspack-plugin' ); ?>
</summary>
<ul>
<?php foreach ( $existing_order_duplicates as $order_duplicates ) : ?>
<?php
if ( in_array( $order_duplicates['ids'], $dismissed_duplicates ) ) {
continue;}
?>
<?php foreach ( $orders_to_display as $order_duplicates ) : ?>
<li style="display: flex; align-items: center;">
<p style="margin: 0;">

Expand Down
Loading