Skip to content

Fixed cookie notice script output in footer - #1025

Open
girishpanchal30 wants to merge 2 commits into
developmentfrom
bugfix/1014
Open

girishpanchal30 wants to merge 2 commits into
developmentfrom
bugfix/1014

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Summary

Refactored cookie notice asset injection to print scripts and styles after the notice bar markup via the wp_footer hook instead of wp_print_footer_scripts. Improved inline JavaScript handling and added comprehensive tests to verify the correct asset injection order and behavior.

Check before Pull Request is ready:

Closes #1014

@pirate-bot

pirate-bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Plugin build for 2cfe3eb is ready 🛎️!

@pirate-bot pirate-bot 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 requested

The hook move fixes issue #1014, but the Accept handler still throws when filtered markup has no checkbox.

Validation details
  • Files reviewed: 4/4 changed files.
  • PHPUnit at HEAD: cd /repo && set -o pipefail; timeout 280 phpunit --do-not-cache-result --filter 'Test_Module_Policy_Notice::test_bar_scr… printed OK (1 test, 6 assertions) (run R3)
  • The new PHPUnit test fails against the pr-base init.php (A/B helper, no run record).
  • Jest at HEAD passes both cases cd /repo && set -o pipefail; timeout 250 npx jest --config tests/js/jest.config.js --verbose --testPathPattern policy-no… (run R6, exit 0). Against the pr-base init.php, both cases fail cd /repo && B=/workspace/checks/C5/jest-base && rm -rf $B && mkdir -p $B && git archive HEAD tests obfx_modules/policy-n… printed Cannot read properties of null (reading 'style') (run R7)
  • Sandbox (twentytwentyfive, module on): the front page prints the bar before the script. The login page prints neither cd /workspace/checks/C7 && set -o pipefail; curl -fsSL --max-redirs 3 http://localhost:8080/ -o front.html; echo "front … (run R14, exit 0).
  • Browser: the bar shows, and Accept hides it and sets the cookie. The login page and the block editor show no null error python3 - <<'PY' from pathlib import Path p=Path('/workspace/checks/C8/observations.md') s=p.read_text().replace('Initia… (run R18, exit 0).
Untested areas
  • PHPCS and the full PHPUnit and Jest suites were not run. CI owns them.
  • The repository has no end-to-end suite.
  • The variant pass did not settle these places, where the fixed cause may still reach:
    • not reached: the truncated Playground payload in requirements.md:29

🤖 Automated review · run code-review-agent_6b043a63cbacb3.78138197.


🤖 Review agent — review posted ✅ on 7df0464d · changes requested · 1 finding · 18 min

Run code-review-agent_6b043a63cbacb3.78138197 · trail

Comment thread obfx_modules/policy-notice/init.php Resolved

@pirate-bot pirate-bot 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.

🟢 Approved

The PR passes: the Accept handler now hides the bar directly, so filtered markup without the checkbox no longer throws.

Validation details
  • Files reviewed: 4/4 changed files.
  • Jest at HEAD passes all three cases mkdir -p /workspace/checks/C2 && cd /repo && set -o pipefail; timeout 300 npx jest --config tests/js/jest.config.js --ve… printed 3 passed (run R1).
  • With the init.php from 7df0464, the new Accept case fails cd /repo && B=/workspace/checks/C2/base && rm -rf $B && mkdir -p $B/tests/js $B/obfx_modules/policy-notice && cp tests/j… printed Cannot set properties of null (setting 'checked') (run R2).
  • Source read: the default notice span, checkbox and close label sit inside #obfx-cookie-bar, so hiding it hides the whole notice.
  • PHPUnit order test and login and editor console checks are reused from run code-review-agent_6b043a63cbacb3.78138197 at 7df0464, not rerun. Commit 2cfe3eb does not touch that code.
Untested areas
  • The login page console was not rechecked at HEAD.
  • The browser check of Accept on the default bar has no harness run record.
  • PHPCS and the full suites were not run. CI owns them.
  • The repository has no end-to-end suite.
  • The variant pass did not settle these places, where the fixed cause may still reach:
    • /workspace/review/requirements.md:29 — unverified: The saved Playground payload is literally truncated, so its complete setup cannot be inspected. The separately recorded symptom and missing-element observation remain available at …

🤖 Automated review · run code-review-agent_6b043fa37646c9.96688054.


🤖 Review agent — review posted ✅ on 2cfe3eba · approved · 0 findings · 10 min

Run code-review-agent_6b043fa37646c9.96688054 · trail

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