Skip to content

Upd. AJAX/REST transport refactored. - #926

Open
alexandergull wants to merge 17 commits into
devfrom
rest-response-ref.ag
Open

alexandergull wants to merge 17 commits into
devfrom
rest-response-ref.ag

Conversation

@alexandergull

Copy link
Copy Markdown
Member

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.17057% with 146 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.57%. Comparing base (96e8410) to head (5f105b4).

Files with missing lines Patch % Lines
lib/Cleantalk/ApbctWP/Variables/AltSessions.php 26.47% 50 Missing ⚠️
lib/Cleantalk/ApbctWP/Antispam/ForceProtection.php 34.92% 41 Missing ⚠️
...antalk/ApbctWP/ContactsEncoder/ContactsEncoder.php 59.74% 31 Missing ⚠️
inc/cleantalk-common.php 42.42% 19 Missing ⚠️
lib/Cleantalk/ApbctWP/AJAXService.php 33.33% 4 Missing ⚠️
lib/Cleantalk/ApbctWP/Helper.php 93.75% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (51.17%) 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     #926      +/-   ##
============================================
+ Coverage     36.90%   37.57%   +0.66%     
- Complexity     7434     7486      +52     
============================================
  Files           301      301              
  Lines         28115    28189      +74     
============================================
+ Hits          10377    10591     +214     
+ Misses        17738    17598     -140     

☔ 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.

🟡 Changes recommended

Active issues leave adjacent phone numbers exposed when the sign budget is exceeded and allow email encoding to insert literal markup into unparsed-text content, changing submitted data.

2 open issues
What changed in this PR

This PR separates AJAX output from shared processing and REST responses in the CleanTalk WordPress plugin. It also updates contact encoding safeguards and frontend form recovery.

Changes:

  • Introduces shared result methods, explicit REST responses, and JSON error handling.
  • Updates decoding-cookie permissions, transport selection, and restored-form handling.
  • Adds contact-processing limits and markup indexing, with corresponding bundled assets.
File Description
tests/​ApbctWP/​TestRestResponses.php Adds transport-response tests; excluded from review.
tests/​ApbctWP/​HelperTest.php Adds JSON-helper tests; excluded from review.
lib/​Cleantalk/​Common/​ContactsEncoder/​Helper/​ContactsEncoderHelper.php Introduces markup scanning and offset indexes.
lib/​Cleantalk/​Common/​ContactsEncoder/​ContactsEncoder.php Adds processing limits, fallback masking, and markup safeguards.
lib/​Cleantalk/​ApbctWP/​Variables/​AltSessions.php Separates cookie processing from AJAX output.
lib/​Cleantalk/​ApbctWP/​RestController.php Routes requests through explicit REST response methods.
lib/​Cleantalk/​ApbctWP/​Helper.php Adds JSON encoding and decoding helpers.
lib/​Cleantalk/​ApbctWP/​ContactsEncoder/​ContactsEncoder.php Shares decoding results across transports and controls cookie permission.
lib/​Cleantalk/​ApbctWP/​Antispam/​ForceProtection.php Separates bot-check results from AJAX serialization.
lib/​Cleantalk/​ApbctWP/​AJAXService.php Extracts reusable JavaScript-key response data.
js/​src/​public-3-check-email.js Preserves the configured transport.
js/​src/​public-2-internal-forms.js Protects restored forms without repeated wrapping.
js/​src/​public-2-force-protection.js Restores forms on transport errors and emits a restoration event.
js/​src/​common-decoder.js Requires backend permission before setting the pass cookie.
js/​prebuild/​apbct-public-bundle.js Synchronizes decoder and transport changes.
js/​prebuild/​apbct-public-bundle_int-protection.js Includes updated internal-form handling.
js/​prebuild/​apbct-public-bundle_int-protection_gathering.js Synchronizes internal-protection and gathering variant.
js/​prebuild/​apbct-public-bundle_gathering.js Synchronizes decoder and transport changes.
js/​prebuild/​apbct-public-bundle_full-protection.js Includes form recovery and protection updates.
js/​prebuild/​apbct-public-bundle_full-protection_gathering.js Synchronizes full-protection and gathering variant.
js/​prebuild/​apbct-public-bundle_ext-protection.js Synchronizes decoder and transport changes.
js/​prebuild/​apbct-public-bundle_ext-protection_gathering.js Synchronizes external-protection and gathering variant.
js/​cleantalk-admin.min.js.map Updates the admin bundle source map.
js/​cleantalk-admin.min.js Includes the updated shared decoder.
inc/​cleantalk-pluggable.php Returns whether the server-side pass mark was saved.
inc/​cleantalk-common.php Extracts shared email-check results and updates AJAX delegation.

Review effort: Balanced

@svedge
svedge requested review from svedge and removed request for svfcode November 16, 2026 05:28

This branch has not been deployed

No deployments
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.

3 participants