Skip to content

Conversation

@JSv4
Copy link
Collaborator

@JSv4 JSv4 commented Oct 19, 2025

Summary

Fixes #41: Implements proper cookie consent persistence for both anonymous and authenticated users.

Backend Changes

  • Added cookie_consent_accepted and cookie_consent_date fields to User model
  • Created migration 0018_user_cookie_consent_accepted_and_more
  • Added AcceptCookieConsent GraphQL mutation with @login_required
  • Mutation records consent timestamp in database

Frontend Changes

  • Added ACCEPT_COOKIE_CONSENT GraphQL mutation
  • Updated CookieConsent component to check authentication status
  • Authenticated users: saves to database via mutation
  • Anonymous users: saves to localStorage only
  • Added error handling with localStorage fallback

Test Plan

  • TypeScript compilation passes
  • Frontend build succeeds
  • Database migration created
  • GraphQL mutation registered

Resolves #41

Implements separate cookie consent handling for anonymous and authenticated users:
- Anonymous users: consent stored in localStorage
- Authenticated users: consent stored in database via GraphQL mutation

Backend Changes:
- Added cookie_consent_accepted (BooleanField) to User model
- Added cookie_consent_date (DateTimeField) to User model
- Created migration 0018_user_cookie_consent_accepted_and_more
- Added AcceptCookieConsent GraphQL mutation with @login_required
- Registered mutation in schema

Frontend Changes:
- Added ACCEPT_COOKIE_CONSENT GraphQL mutation to mutations.ts
- Updated CookieConsent component to check authentication status
- For authenticated users: calls mutation to save consent to database
- For anonymous users: saves consent to localStorage
- Added loading states and error handling with fallback to localStorage
- Added toast notifications for success/error states

This ensures cookie consent is properly tracked and persisted based on user type,
preventing the modal from repeatedly appearing after acceptance.
@codecov
Copy link

codecov bot commented Oct 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@JSv4 JSv4 merged commit 3ad880e into main Oct 20, 2025
11 checks passed
@JSv4 JSv4 deleted the feature/issue-41-cookie-modal-revamp branch October 20, 2025 01:40
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.

[FEATURE] - Revamp Cookie Modal Behavior

2 participants