Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cookiebar JS #100

Merged
merged 14 commits into from
Sep 24, 2023
Merged

Refactor cookiebar JS #100

merged 14 commits into from
Sep 24, 2023

Conversation

sergei-maertens
Copy link
Collaborator

Closes #99

@codecov
Copy link

codecov bot commented Jun 19, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.97%. Comparing base (2578fc0) to head (c89fffe).
Report is 69 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   96.77%   94.97%   -1.81%     
==========================================
  Files          25       12      -13     
  Lines         714      398     -316     
  Branches        0       64      +64     
==========================================
- Hits          691      378     -313     
+ Misses         23       15       -8     
- Partials        0        5       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

There are essentially two main flows to the cookie consent bar that
logically follow each other with normal use:

1. The user is new and hasn't accepted or declined any cookie groups,
   or new cookie groups were added that were previously unseen. When
   the user accepts/declines those cookie groups, the onAccept or
   onDeclined callback needs to execute for those cookie groups.

2. The user has previously accepted or declined cookies, but the
   associated (tracking/analytics) scripts are only loaded/activated
   conditionally (or deactivated with opt-out). The user already
   consented, so this should also call the onAccept/onDeclined
   callbacks with the relevant cookie groups.

Of course, developers can use the template tags to conditionally
emit certain scripts, but that gets in the way of aggressive page/
template caching and is the reason why the original JS solution isn't
useful in those situations.
This helps enforce that the Javascript works correctly and *keeps*
working correctly.
cookie_consent/cache.py Show resolved Hide resolved
cookie_consent/templatetags/cookie_consent_tags.py Outdated Show resolved Hide resolved
cookie_consent/urls.py Show resolved Hide resolved
@sergei-maertens sergei-maertens changed the title WIP Refactor cookiebar JS Refactor cookiebar JS Sep 21, 2023
Tests themselves should not be included in coverage stats,
and really only the application itself is relevant.
@sergei-maertens
Copy link
Collaborator Author

Can't really do much about the coverage drop because of the tests themselves being excluded from coverage reporting, so I'm merging this as-is and I'll release a beta version.

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.

Re-implement showCookieBar Javascript
1 participant