Skip to content

Show a dismissible confirmation for pending reviews - #3024

Open
the-sohan wants to merge 1 commit into
sovware:developmentfrom
the-sohan:fix/review-moderation-notice
Open

the-sohan wants to merge 1 commit into
sovware:developmentfrom
the-sohan:fix/review-moderation-notice

Conversation

@the-sohan

Copy link
Copy Markdown

PR Type

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Documentation
  • Other

Description

Pending reviews were rendered with a low-emphasis inline moderation message, so users could easily miss the successful submission state. The existing alert close handler also waited for the window load event and only bound to buttons present at that moment, which could leave the close icon unresponsive.

This PR:

  • renders the pending-review message as a persistent success alert;
  • adds an accessible dismiss button;
  • delegates the dismiss interaction so it works for dynamically rendered review notices and regardless of bundle load timing;
  • keeps the existing single-review behavior: the review button remains unavailable while that user's review is pending;
  • rebuilds the affected public bundles.

How to reproduce

  1. Configure reviews to require moderation.
  2. Sign in as a regular user and submit a review on a single listing.
  3. Confirm that the review is pending in WordPress and hidden from other users.
  4. Return to the review section as the submitting user.
  5. Before this change, the moderation feedback is easy to miss and the close icon may not respond.

Local verification

  1. Submitted a review as a regular user with moderation enabled.
  2. Confirmed the pending review appears as a prominent success notice and remains visible until dismissed.
  3. Clicked the close icon using a normal browser interaction and confirmed the notice was removed.
  4. Confirmed the review remains pending and unavailable to other users.
  5. Confirmed the review button remains hidden while the user's review is pending, which is the expected single-review behavior.
  6. Ran php -l includes/review/class-review-walker.php.
  7. Ran Prettier and JavaScript syntax checks for the source component and generated bundles.
  8. Ran npm run build-legacy and git diff --check.

Screenshot

Pending review confirmation with dismiss button

Notes if any

  • The notice intentionally does not auto-dismiss after five seconds; it stays visible until the visitor closes it, which prevents the confirmation from being missed.
  • The legacy build completed with its existing CSS compatibility and bundle-size warnings.
  • The repository PHPCS command could not complete under local PHP 8.5 because the bundled WordPress Coding Standards dependency aborts on a PHP compatibility deprecation in PHPCSHelper.php:98. PHP syntax validation passed.

Any linked issues

Checklist

  • My code follows WordPress coding standards

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.

1 participant