Skip to content

fix: default analytics cookies checkbox to unchecked#4941

Open
aseckin wants to merge 3 commits into
mainfrom
claude/issue-2171-set-analytics-cookies-to-unchecked
Open

fix: default analytics cookies checkbox to unchecked#4941
aseckin wants to merge 3 commits into
mainfrom
claude/issue-2171-set-analytics-cookies-to-unchecked

Conversation

@aseckin

@aseckin aseckin commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #2171

Summary

Changes the default state of the "Analytics cookies" checkbox in the cookie consent customize modal from checked to unchecked.

Note

This also affects the "Accept and close" button: since it reads from the same state, clicking it without customizing will no longer grant analytics consent. If "Accept and close" should still accept all cookies, a follow-up change to submitBanner is needed.

Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated cookie consent handling so analytics permission is saved and applied more consistently.
    • The analytics option now defaults to off, making the “necessary only” choice clearer.
    • Improved the behavior of the cookie banner actions so “accept” and “necessary only” selections are recorded correctly and the page refreshes with the updated preference.

Closes #2171

Co-authored-by: aseckin <aseckin@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c8f58ec9-eefb-4764-82ac-d937e2f5c3a8

📥 Commits

Reviewing files that changed from the base of the PR and between fdc1dd7 and 6b24c78.

📒 Files selected for processing (1)
  • front_end/src/app/(main)/components/cookies_banner/index.tsx

📝 Walkthrough

Walkthrough

The cookies banner now starts with analytics unchecked and records consent through an explicit boolean path. Button actions and modal submission were updated to pass the consent choice directly before persisting it and refreshing the page.

Changes

Cookies banner consent flow

Layer / File(s) Summary
Consent state and submit wiring
front_end/src/app/(main)/components/cookies_banner/index.tsx
analyticsCheckboxValue now starts false, submitBanner accepts an explicit analytics-consent boolean, and the banner buttons and modal submission pass that boolean through directly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A bunny hops with ears held high,
The analytics checkbox now says “no” by default, oh my!
One little click, consent takes flight,
And cookies dance in logic just right.
(__/)✨

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: the analytics cookies checkbox defaults to unchecked.
Linked Issues check ✅ Passed The PR sets the Analytics cookies checkbox to unchecked by default, matching issue #2171.
Out of Scope Changes check ✅ Passed The consent-handling updates support the stated follow-up behavior and stay within scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-2171-set-analytics-cookies-to-unchecked

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@aseckin

aseckin commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@claude implement the follow-up change so clicking "Accept All" properly accepts all, without the need to check the analytics box

@claude

claude Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Claude finished @aseckin's task in 1m 35s —— View job


Implementing follow-up: "Accept and close" should accept all cookies

  • Analyze current submitBanner logic
  • Design clean signature so each button expresses its intent
  • Refactor submitBanner and update call sites
  • Commit to PR branch

Summary

Refactored submitBanner to take an explicit analyticsConsent: boolean so each call site states its own intent instead of inferring it from analyticsCheckboxValue:

  • "Necessary only" → submitBanner(false)
  • "Accept and close" → submitBanner(true) (now correctly grants analytics consent)
  • Modal "Save selected" → submitBanner(analyticsCheckboxValue)

This decouples the banner's "Accept and close" path from the modal's checkbox state, so the unchecked default from this PR no longer leaks into the accept-all flow.

Commit: 6b24c78
· branch: claude/issue-2171-set-analytics-cookies-to-unchecked

Refactors submitBanner to take an explicit analyticsConsent boolean so
each call site decides intent: "Necessary only" → false, "Accept and
close" → true, modal "Save selected" → checkbox value. Previously, with
the analytics checkbox defaulting to unchecked, "Accept and close" would
silently deny analytics consent.

Co-authored-by: aseckin <aseckin@users.noreply.github.com>
@claude claude Bot temporarily deployed to testing_env June 25, 2026 11:30 Inactive
@claude claude Bot temporarily deployed to testing_env June 25, 2026 11:30 Inactive
@aseckin aseckin marked this pull request as ready for review June 25, 2026 11:40
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-4941-claude-issue-2171-set-analytic-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-2171-set-analytics-cookies-to-unchecked-9ac3e9f
🗄️ PostgreSQL NeonDB branch preview/pr-4941-claude-issue-2171-set-analytic
Redis Fly Redis mtc-redis-pr-4941-claude-issue-2171-set-analytic

Details

  • Commit: f06de7a7e344b9a72802ffcfaa293268a5345627
  • Branch: claude/issue-2171-set-analytics-cookies-to-unchecked
  • Fly App: metaculus-pr-4941-claude-issue-2171-set-analytic

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

@aseckin aseckin requested a review from ncarazon June 25, 2026 11:54
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.

Set "Analytics cookies" to unchecked by default.

2 participants