Skip to content

Upd. Search. Improved flow of keeping token.#807

Open
svfcode wants to merge 1 commit into
devfrom
ref-search-flow
Open

Upd. Search. Improved flow of keeping token.#807
svfcode wants to merge 1 commit into
devfrom
ref-search-flow

Conversation

@svfcode

@svfcode svfcode commented Jun 7, 2026

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings June 7, 2026 11:48

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 improves the “search” flow by proactively syncing the bot-detector event token into alternative cookies when a page contains a GET-based search form markup used by popular WordPress themes (so search requests can carry the token even when submit-middleware can’t intercept).

Changes:

  • Added popular-theme search form detection + a throttled (5 min) token sync to alternative cookies in the public handler.
  • Wired the new token sync into the public init flow and the botDetectorEventTokenUpdated event path.
  • Rebuilt generated JS bundles/minified assets (including admin edit-screen scripts).

Reviewed changes

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

Show a summary per file
File Description
js/src/public-1-main.js Adds theme search form detection and throttled token sync; hooks it into init + token-updated flow.
js/prebuild/apbct-public-bundle.js Rebuilt bundle with the new search token sync logic.
js/prebuild/apbct-public-bundle_int-protection.js Rebuilt bundle variant with the new search token sync logic.
js/prebuild/apbct-public-bundle_int-protection_gathering.js Rebuilt bundle variant with the new search token sync logic.
js/prebuild/apbct-public-bundle_gathering.js Rebuilt bundle variant with the new search token sync logic.
js/prebuild/apbct-public-bundle_full-protection.js Rebuilt bundle variant with the new search token sync logic.
js/prebuild/apbct-public-bundle_full-protection_gathering.js Rebuilt bundle variant with the new search token sync logic.
js/prebuild/apbct-public-bundle_ext-protection.js Rebuilt bundle variant with the new search token sync logic.
js/prebuild/apbct-public-bundle_ext-protection_gathering.js Rebuilt bundle variant with the new search token sync logic.
js/cleantalk-users-editscreen.min.js Rebuilt minified asset (blacklist-link insertion behavior).
js/cleantalk-users-editscreen.min.js.map Updated source map for rebuilt minified asset.
js/cleantalk-comments-editscreen.min.js Rebuilt minified asset (blacklist-link insertion behavior).
js/cleantalk-comments-editscreen.min.js.map Updated source map for rebuilt minified asset.
js/apbct-public-bundle.min.js Rebuilt minified public bundle including the new search token sync logic.

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

Comment thread js/src/public-1-main.js
Comment on lines +1399 to +1405
/**
* LS key: timestamp (ms) of the last successful search-form token sync to alt cookies.
* @return {string}
*/
getSearchFormTokenAltCookieSentAtLsKey() {
return 'apbct_search_form_token_alt_cookie_sent_at';
}
Comment thread js/src/public-1-main.js
Comment on lines +2097 to +2099
if (+ctPublic.settings__forms__search_test === 1) {
handler.searchFormMiddlewareJustSetTokenToAlternativeCookie();
}
@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.09%. Comparing base (1df40e6) to head (5b7de63).

Additional details and impacted files
@@            Coverage Diff            @@
##                dev     #807   +/-   ##
=========================================
  Coverage     26.09%   26.09%           
  Complexity     5631     5631           
=========================================
  Files           265      265           
  Lines         24157    24157           
=========================================
  Hits           6304     6304           
  Misses        17853    17853           

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

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