New. Woocommerce. Spam order details popup implemented.#812
New. Woocommerce. Spam order details popup implemented.#812alexandergull wants to merge 10 commits into
Conversation
# Conflicts: # js/apbct-public-bundle.min.js # js/apbct-public-bundle_ext-protection.min.js # js/apbct-public-bundle_ext-protection_gathering.min.js # js/apbct-public-bundle_full-protection.min.js # js/apbct-public-bundle_full-protection_gathering.min.js # js/apbct-public-bundle_gathering.min.js # js/apbct-public-bundle_int-protection.min.js # js/apbct-public-bundle_int-protection_gathering.min.js
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (65.78%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #812 +/- ##
============================================
+ Coverage 26.57% 26.64% +0.06%
- Complexity 5676 5691 +15
============================================
Files 269 269
Lines 24258 24290 +32
============================================
+ Hits 6446 6471 +25
- Misses 17812 17819 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds an admin “See details” action for stored WooCommerce spam orders, exposing an authenticated AJAX endpoint to fetch full order/customer JSON and rendering it in a modal in the admin UI.
Changes:
- Added
apbct_details_spam_orderAJAX handler and a shared response-prep helper for returning decoded order/customer details. - Added a new row action (“See details”) to the WooCommerce spam orders list and a modal-based UI to display the details.
- Added unit tests covering
WcSpamOrdersFunctions::prepareDetailsOrderResponse()behavior across error and success scenarios.
Reviewed changes
Copilot reviewed 14 out of 25 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ApbctWP/TestWcSpamOrdersFunctions.php | New unit tests for prepareDetailsOrderResponse() (validation, not-found, happy path). |
| lib/Cleantalk/ApbctWP/WcSpamOrdersListTable.php | Adds “See details” row action link for spam orders. |
| lib/Cleantalk/ApbctWP/WcSpamOrdersFunctions.php | Fixes wording (“not found”) and adds details AJAX handler + response helper. |
| lib/Cleantalk/Antispam/IntegrationsByClass/Woocommerce.php | Registers the new admin AJAX action. |
| js/src/cleantalk-admin.js | Adds click handler + modal rendering helper for viewing spam order details. |
| css/src/cleantalk-admin.css | Styles for the new modal content/table rendering. |
| js/cleantalk-admin.min.js.map | Rebuilt source map including new admin JS logic. |
| js/cleantalk-admin.min.js | Rebuilt minified admin bundle including new modal logic. |
| css/cleantalk-admin.min.css | Rebuilt minified admin CSS including new styles. |
| js/cleantalk-users-editscreen.min.js.map | Rebuilt map (unrelated build output change). |
| js/cleantalk-users-editscreen.min.js | Rebuilt minified file (unrelated build output change). |
| js/cleantalk-comments-editscreen.min.js.map | Rebuilt map (unrelated build output change). |
| js/cleantalk-comments-editscreen.min.js | Rebuilt minified file (unrelated build output change). |
Files not reviewed (1)
- css/cleantalk-admin.min.css: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5fb9ac1 to
1531a0f
Compare
# Conflicts: # js/prebuild/apbct-public-bundle.js # js/prebuild/apbct-public-bundle_ext-protection.js # js/prebuild/apbct-public-bundle_ext-protection_gathering.js # js/prebuild/apbct-public-bundle_full-protection.js # js/prebuild/apbct-public-bundle_full-protection_gathering.js # js/prebuild/apbct-public-bundle_gathering.js # js/prebuild/apbct-public-bundle_int-protection.js # js/prebuild/apbct-public-bundle_int-protection_gathering.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
|
||
| $response_data = self::prepareDetailsOrderResponse( | ||
| $order_id, | ||
| ['class' => self::class, 'method' => 'getOrderDataById'] |
There was a problem hiding this comment.
Why this abstraction implemented? Why not more simple?:
$order_data = self::getOrderDataById($order_id);
$response_data = self::prepareDetailsOrderResponse(
$order_id,
$order_data
);|
Please rename the PR according to the standard. |
| modalContent.append(containerHeader); | ||
| modalContent.append(container); | ||
| modalContent.append(containerHeader); | ||
| modalContent.append(container); |
| } else { | ||
| const error = result.data.error || 'Unknown error occurred'; | ||
| modalContent.text(error); | ||
| } |
| } else { | ||
| alert('Can not initialize CleanTalk modal window.'); | ||
| } |
| console.error('AJAX Error:', error); | ||
| alert('An error occurred while processing your request, see console for details.'); | ||
| }, |
| $actions = array( | ||
| 'restore' => '<a class="apbct-restore-spam-order-button" data-spam-order-id="' . $wc_spam_order->id . '">' . esc_html__('Restore', 'cleantalk-spam-protect') . '</a>', | ||
| 'delete' => '<a onclick="return confirm(\'' . esc_attr(esc_html__('Are you sure?', 'cleantalk-spam-protect')) . '\')" href="' . esc_url($delete_url) . '">Delete</a>', | ||
| 'details' => '<a class="apbct-details-spam-order-button" role="button" tabindex="0" data-spam-order-id="' . esc_attr($wc_spam_order->id) . '">' . esc_html__('See details', 'cleantalk-spam-protect') . '</a>', |
https://app.doboard.com/1/task/42657