From 3cd53cbd41267883721039fe405e431d9e1322a5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Wed, 24 May 2023 10:45:06 +0200 Subject: [PATCH 1/2] Adds some keys to this cached element, due to cookie banner Once the user accept the cookie, we should not show the cookie banner element. This is handled via `app/helpers/footer_links_helper.rb#cookies_policy_link` and boolean: ``` !Web::CookiesConsent.new(cookies, request.host).exists? && Spree::Config.cookies_consent_banner_toggle ``` --- app/views/shared/_footer.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shared/_footer.html.haml b/app/views/shared/_footer.html.haml index a4f1f3a3e49..bed768751cb 100644 --- a/app/views/shared/_footer.html.haml +++ b/app/views/shared/_footer.html.haml @@ -96,7 +96,7 @@ %hr.hr-light %br - = cache_with_locale [ContentConfig.cache_key, TermsOfServiceFile.current_url, Spree::Config.privacy_policy_url] do + = cache_with_locale [ContentConfig.cache_key, TermsOfServiceFile.current_url, Spree::Config.privacy_policy_url, Spree::Config.cookies_consent_banner_toggle, Web::CookiesConsent.new(cookies, request.host)] do .row.legal .small-12.medium-3.medium-offset-2.columns.text-left %a{href: main_app.root_path} From ca107c036ccee5866983e9ed825eca71899b578e Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 24 May 2023 16:14:53 +0100 Subject: [PATCH 2/2] Enables caching for cookies_spec.rb --- spec/system/consumer/cookies_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/consumer/cookies_spec.rb b/spec/system/consumer/cookies_spec.rb index 2026b3d457d..b618ee3a7d2 100644 --- a/spec/system/consumer/cookies_spec.rb +++ b/spec/system/consumer/cookies_spec.rb @@ -2,7 +2,7 @@ require 'system_helper' -describe "Cookies" do +describe "Cookies", caching: true do describe "banner" do # keeps banner toggle config unchanged around do |example|