Skip to content

wc_spam_order_details.ag#812

Open
alexandergull wants to merge 4 commits into
devfrom
wc_spam_order_details.ag
Open

wc_spam_order_details.ag#812
alexandergull wants to merge 4 commits into
devfrom
wc_spam_order_details.ag

Conversation

@alexandergull

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings June 17, 2026 11:13
# 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

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.14286% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.45%. Comparing base (87317d1) to head (20f171b).

Files with missing lines Patch % Lines
lib/Cleantalk/ApbctWP/WcSpamOrdersFunctions.php 61.53% 10 Missing ⚠️
...ntalk/Antispam/IntegrationsByClass/Woocommerce.php 0.00% 1 Missing ⚠️
lib/Cleantalk/ApbctWP/WcSpamOrdersListTable.php 0.00% 1 Missing ⚠️

❌ 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_order AJAX 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.

Comment thread js/src/cleantalk-admin.js
_ajax_nonce: ctAdminCommon._ajax_nonce,
order_id: spmOrderId,
};
if (cleantalkModal !== undefined) {
Comment thread js/src/cleantalk-admin.js
const error = result.data.error || 'Unknown error occurred';
modalContent.text(error);
}
cleantalkModal.loaded = true;
Comment thread js/src/cleantalk-admin.js
Comment on lines +194 to +199
const firstKey = Object.keys(orderDetails)[0];
if (firstKey) {
container.appendChild(
createTableFromObject(orderDetails[firstKey], 'Order Details'),
);
}
Comment on lines +92 to +94
} 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>',
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.

2 participants