From 9f47e452f09bee4c39bfa5af0c0afda86832c741 Mon Sep 17 00:00:00 2001 From: Nico Picchio <70696511+nicopicchio@users.noreply.github.com> Date: Mon, 13 May 2024 14:09:53 +0100 Subject: [PATCH] DWPF-1517 Removal of cookie banner (#560) --- assets/stylesheets/application.scss | 1 - assets/stylesheets/components/_cookie_bar.scss | 9 --------- pii-ner-exclude.txt | 1 - src/content/models.py | 2 -- src/core/templates/includes/header.html | 2 -- src/core/templates/tags/cookie_banner.html | 15 --------------- src/core/templatetags/cookie_banner.py | 13 ------------- src/core/utils.py | 9 --------- src/news/models.py | 4 ---- 9 files changed, 56 deletions(-) delete mode 100644 assets/stylesheets/components/_cookie_bar.scss delete mode 100644 src/core/templates/tags/cookie_banner.html delete mode 100644 src/core/templatetags/cookie_banner.py diff --git a/assets/stylesheets/application.scss b/assets/stylesheets/application.scss index 74cbc2a14..83edc04ba 100644 --- a/assets/stylesheets/application.scss +++ b/assets/stylesheets/application.scss @@ -26,7 +26,6 @@ $moj-assets-path: "/static/moj-frontend/"; @import "components/accordion"; @import "components/content_cards"; @import "components/content_page"; -@import "components/cookie_bar"; @import "components/home"; @import "components/home_new"; @import "components/layout"; diff --git a/assets/stylesheets/components/_cookie_bar.scss b/assets/stylesheets/components/_cookie_bar.scss deleted file mode 100644 index 3d40c3f7b..000000000 --- a/assets/stylesheets/components/_cookie_bar.scss +++ /dev/null @@ -1,9 +0,0 @@ -.cookie-banner { - background-color: $brand-color-lightblue; - p { - color: white; - a, a:visited, a:link { - color: white; - } - } -} \ No newline at end of file diff --git a/pii-ner-exclude.txt b/pii-ner-exclude.txt index 0f8f5647d..871a7ea75 100644 --- a/pii-ner-exclude.txt +++ b/pii-ner-exclude.txt @@ -408,7 +408,6 @@ SD SE search_and_profile_bar.html search_keyword_or_phrase__pk -seen_cookie_banner self.seo_title SerializerMethodField Server-Authorization' diff --git a/src/content/models.py b/src/content/models.py index c1f19e668..c20b0b401 100644 --- a/src/content/models.py +++ b/src/content/models.py @@ -24,7 +24,6 @@ from content import blocks from content.utils import manage_excluded, manage_pinned, truncate_words_and_chars -from core.utils import set_seen_cookie_banner from extended_search.index import DWIndexedField as IndexedField from extended_search.index import Indexed from peoplefinder.widgets import PersonChooser @@ -81,7 +80,6 @@ class BasePage(Page, Indexed): def serve(self, request): response = super().serve(request) - set_seen_cookie_banner(request, response) return response diff --git a/src/core/templates/includes/header.html b/src/core/templates/includes/header.html index b089d7518..f05910dee 100644 --- a/src/core/templates/includes/header.html +++ b/src/core/templates/includes/header.html @@ -1,6 +1,5 @@ {% load menu_tags waffle_tags %} {% load render_bundle webpack_static from webpack_loader %} -{% load cookie_banner %} {% load site_alert %}
-{% cookie_banner %} {% if FEATURE_FLAGS.new_homepage %} {% else %} {% if USER_IS_AUTHENTICATED %} diff --git a/src/core/templates/tags/cookie_banner.html b/src/core/templates/tags/cookie_banner.html deleted file mode 100644 index 69ed3a5d7..000000000 --- a/src/core/templates/tags/cookie_banner.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load static wagtailcore_tags %} - -{% if not seen_cookie_banner %} - -{% endif %} diff --git a/src/core/templatetags/cookie_banner.py b/src/core/templatetags/cookie_banner.py deleted file mode 100644 index c077c3428..000000000 --- a/src/core/templatetags/cookie_banner.py +++ /dev/null @@ -1,13 +0,0 @@ -from django import template - - -register = template.Library() - - -@register.inclusion_tag("tags/cookie_banner.html", takes_context=True) -def cookie_banner(context): - request = context["request"] - seen_cookie_banner = request.COOKIES.get("seen_cookie_banner") - return { - "seen_cookie_banner": seen_cookie_banner, - } diff --git a/src/core/utils.py b/src/core/utils.py index b54fdbbe2..86435f0e1 100644 --- a/src/core/utils.py +++ b/src/core/utils.py @@ -3,15 +3,6 @@ from core.models import FeatureFlag -def set_seen_cookie_banner(request, response): - if not request.COOKIES.get("seen_cookie_banner"): - response.set_cookie( - "seen_cookie_banner", - 1, - secure=False, - ) - - def get_all_feature_flags(request): return { flag.name: flag_is_active(request, flag.name) diff --git a/src/news/models.py b/src/news/models.py index 5de1eebc9..72013488c 100644 --- a/src/news/models.py +++ b/src/news/models.py @@ -12,7 +12,6 @@ from wagtail.snippets.models import register_snippet from content.models import BasePage -from core.utils import set_seen_cookie_banner from extended_search.index import DWIndexedField as IndexedField from news.forms import CommentForm from working_at_dit.models import PageWithTopics @@ -215,7 +214,6 @@ def serve(self, request, *args, **kwargs): context["comment_form"] = CommentForm() response = TemplateResponse(request, self.template, context) - set_seen_cookie_banner(request, response) return response @@ -243,7 +241,6 @@ def news_home(self, request): self.get_template(request), context, ) - set_seen_cookie_banner(request, response) return response @@ -257,7 +254,6 @@ def category_home(self, request, category_slug): self.get_template(request), context, ) - set_seen_cookie_banner(request, response) return response