New. Integration. Integration with Email Subscribers#809
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #809 +/- ##
============================================
+ Coverage 26.25% 26.46% +0.21%
- Complexity 5632 5667 +35
============================================
Files 265 269 +4
Lines 24160 24240 +80
============================================
+ Hits 6344 6416 +72
- Misses 17816 17824 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a dedicated CleanTalk integration for the Email Subscribers by Icegram Express plugin, moving handling from the generic AJAX hook into the integrations-by-hook framework.
Changes:
- Introduces
Cleantalk\Antispam\Integrations\EmailSubscribersto collect subscription POST data and return a standardized block JSON payload. - Registers the new integration in
inc/cleantalk-integrations-by-hook.phpfor thees_add_subscriberAJAX action. - Removes the legacy
es_add_subscriberspecial-case fromct_ajax_hook().
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lib/Cleantalk/Antispam/Integrations/EmailSubscribers.php |
New integration implementation: data extraction + AJAX block response. |
inc/cleantalk-pluggable.php |
Adds a skip rule for es_add_subscriber when Email Subscribers is active. |
inc/cleantalk-integrations-by-hook.php |
Registers EmailSubscribers integration on es_add_subscriber (AJAX). |
inc/cleantalk-ajax.php |
Removes legacy hardcoded handling for es_add_subscriber. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
alexandergull
approved these changes
Jun 10, 2026
svfcode
approved these changes
Jun 11, 2026
Glomberg
approved these changes
Jun 11, 2026
Comment on lines
+197
to
+216
| /** | ||
| * Test doBlock returns ES-compatible error array in non-AJAX mode (filter path) | ||
| */ | ||
| public function testDoBlockReturnsErrorArrayNonAjax() | ||
| { | ||
| // DOING_AJAX is not defined or false in non-AJAX context | ||
| // In test env DOING_AJAX may already be defined, so we test the return format | ||
| // by reading the source | ||
| $source = file_get_contents( | ||
| dirname(__FILE__, 4) . '/lib/Cleantalk/Antispam/Integrations/EmailSubscribers.php' | ||
| ); | ||
| // Must return array with 'status' => 'ERROR' for the filter path | ||
| $this->assertStringContainsString("'status' => 'ERROR'", $source); | ||
| $this->assertStringContainsString("'message_text' => \$message", $source); | ||
| // Must have DOING_AJAX check to differentiate AJAX vs filter path | ||
| $this->assertStringContainsString("defined('DOING_AJAX') && DOING_AJAX", $source); | ||
| // Must use wp_send_json for AJAX path (not wp_send_json_error) | ||
| $this->assertStringContainsString('wp_send_json(', $source); | ||
| $this->assertStringNotContainsString('wp_send_json_error', $source); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+200
to
+216
| public function testDoBlockReturnsErrorArrayNonAjax() | ||
| { | ||
| // DOING_AJAX is not defined or false in non-AJAX context | ||
| // In test env DOING_AJAX may already be defined, so we test the return format | ||
| // by reading the source | ||
| $source = file_get_contents( | ||
| dirname(__FILE__, 4) . '/lib/Cleantalk/Antispam/Integrations/EmailSubscribers.php' | ||
| ); | ||
| // Must return array with 'status' => 'ERROR' for the filter path | ||
| $this->assertStringContainsString("'status' => 'ERROR'", $source); | ||
| $this->assertStringContainsString("'message_text' => \$message", $source); | ||
| // Must have DOING_AJAX check to differentiate AJAX vs filter path | ||
| $this->assertStringContainsString("defined('DOING_AJAX') && DOING_AJAX", $source); | ||
| // Must use wp_send_json for AJAX path (not wp_send_json_error) | ||
| $this->assertStringContainsString('wp_send_json(', $source); | ||
| $this->assertStringNotContainsString('wp_send_json_error', $source); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://app.doboard.com/1/task/49806