wc_spam_order_details.ag#812
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 (57.14%) 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.41% 26.45% +0.04%
- Complexity 5655 5664 +9
============================================
Files 268 268
Lines 24220 24242 +22
============================================
+ Hits 6398 6414 +16
- Misses 17822 17828 +6 ☔ 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.
| _ajax_nonce: ctAdminCommon._ajax_nonce, | ||
| order_id: spmOrderId, | ||
| }; | ||
| if (cleantalkModal !== undefined) { |
| const error = result.data.error || 'Unknown error occurred'; | ||
| modalContent.text(error); | ||
| } | ||
| cleantalkModal.loaded = true; |
| const firstKey = Object.keys(orderDetails)[0]; | ||
| if (firstKey) { | ||
| container.appendChild( | ||
| createTableFromObject(orderDetails[firstKey], 'Order Details'), | ||
| ); | ||
| } |
| } catch (\Exception $e) { | ||
| $response_data['error'] = esc_html__('Error: ' . $e->getMessage(), 'cleantalk-spam-protect'); | ||
| } |
| * | ||
| * @covers \Cleantalk\ApbctWP\WcSpamOrdersFunctions::prepareDetailsOrderResponse | ||
| */ | ||
| class WcSpamOrdersFunctionsTest extends TestCase |
| $this->assertSame(777, $capturedId); | ||
| } | ||
|
|
||
| // makeOrderRow нужен публично для использования внутри замыкания выше |
| $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" data-spam-order-id="' . $wc_spam_order->id . '">' . esc_html__('See details', 'cleantalk-spam-protect') . '</a>', |
No description provided.