Skip to content

Upd. ContactEncoder. Improve shortcode flow.#827

Open
svfcode wants to merge 4 commits into
devfrom
upd-contact-encoder-shortcode-flow
Open

Upd. ContactEncoder. Improve shortcode flow.#827
svfcode wants to merge 4 commits into
devfrom
upd-contact-encoder-shortcode-flow

Conversation

@svfcode

@svfcode svfcode commented Jul 1, 2026

Copy link
Copy Markdown
Member

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 pull request updates the ContactsEncoder shortcode/buffer pipeline so shortcode placeholders are handled more predictably (including in output-buffer mode), adds a dedicated shortcode-placeholder exclusion path, and expands unit coverage around paragraph wrapper preservation and decoder-pass cookie behavior.

Changes:

  • Refactors buffer-mode flow to run shortcode placeholder preparation/finalization around ContactsEncoder::modifyContent() and adjusts hook registrations/priorities.
  • Updates shortcode exclusion/encoding logic (including new doReturnShortcodeContentBeforeModify() and resetting placeholder state after use).
  • Adds/updates tests for paragraph wrapper preservation, shutdown/buffer behavior, and decoder cookie scenarios.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php Adds tests ensuring placeholders are used even when decoder cookie is set / global encoding disabled.
tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php Adds buffer-mode regression tests for <p> wrapper preservation and cookie-based encoding skip.
tests/ApbctWP/ContactsEncoder/Shortcodes/ExcludedEncodeContentSCTest.php Updates tests to reflect shutdown-only behavior in buffer mode and adds coverage for using $apbct->buffer during shutdown.
lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/ShortCodesService.php Adds buffer pre/post helpers and an encode-only “after modify” hook registration method.
lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/ExcludedEncodeContentSC.php Restricts buffer-mode processing to shutdown and only falls back to $apbct->buffer when input content is empty.
lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/EncodeContentSC.php Switches to WP ExclusionsService, uses shortcode-specific exclusions, and resets shortcode replacement state after restoration.
lib/Cleantalk/ApbctWP/ContactsEncoder/Exclusions/ExclusionsService.php Adds decoder-pass cookie exclusion for global encoding and introduces shortcode-placeholder-specific exclusion method.
lib/Cleantalk/ApbctWP/ContactsEncoder/ContactsEncoder.php Reworks buffer-mode hook wiring and routes buffer processing through ShortCodesService pre/post methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php Outdated
Comment thread tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php Outdated
@svfcode svfcode requested a review from Copilot July 2, 2026 05:47
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.07143% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.97%. Comparing base (de47160) to head (7c14b58).
⚠️ Report is 11 commits behind head on dev.

Files with missing lines Patch % Lines
...P/ContactsEncoder/Exclusions/ExclusionsService.php 76.47% 4 Missing ⚠️
...P/ContactsEncoder/Shortcodes/ShortCodesService.php 92.85% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #827      +/-   ##
============================================
+ Coverage     26.68%   26.97%   +0.29%     
- Complexity     5683     5820     +137     
============================================
  Files           270      278       +8     
  Lines         24260    24606     +346     
============================================
+ Hits           6473     6637     +164     
- Misses        17787    17969     +182     

☔ 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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php Outdated

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread tests/ApbctWP/ContactsEncoder/TestContactsEncoder.php

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@alexandergull alexandergull removed the request for review from alexander-b-clean July 4, 2026 18:05
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.

4 participants