Add cookie_policy_url field to cookie banners
Introduce a required cookie_policy_url alongside the existing
privacy_policy_url (now optional) so banners can link directly to a
dedicated cookie policy — a compliance best practice recommended by
CNIL, ICO, and the EDPB. Existing rows are seeded from their current
privacy_policy_url value.
Both {{cookie_policy_link}} and {{privacy_policy_link}} placeholders
are supported independently in banner description translations.
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -35,7 +35,8 @@ type (
|
||||
Name string `db:"name"`
|
||||
Origin string `db:"origin"`
|
||||
State CookieBannerState `db:"state"`
|
||||
PrivacyPolicyURL string `db:"privacy_policy_url"`
|
||||
PrivacyPolicyURL *string `db:"privacy_policy_url"`
|
||||
CookiePolicyURL string `db:"cookie_policy_url"`
|
||||
ConsentExpiryDays int `db:"consent_expiry_days"`
|
||||
ConsentMode CookieConsentMode `db:"consent_mode"`
|
||||
ShowBranding bool `db:"show_branding"`
|
||||
@@ -85,6 +86,7 @@ SELECT
|
||||
origin,
|
||||
state,
|
||||
privacy_policy_url,
|
||||
cookie_policy_url,
|
||||
consent_expiry_days,
|
||||
consent_mode,
|
||||
show_branding,
|
||||
@@ -136,6 +138,7 @@ SELECT
|
||||
origin,
|
||||
state,
|
||||
privacy_policy_url,
|
||||
cookie_policy_url,
|
||||
consent_expiry_days,
|
||||
consent_mode,
|
||||
show_branding,
|
||||
@@ -188,6 +191,7 @@ SELECT
|
||||
origin,
|
||||
state,
|
||||
privacy_policy_url,
|
||||
cookie_policy_url,
|
||||
consent_expiry_days,
|
||||
consent_mode,
|
||||
show_branding,
|
||||
@@ -246,6 +250,7 @@ SELECT
|
||||
origin,
|
||||
state,
|
||||
privacy_policy_url,
|
||||
cookie_policy_url,
|
||||
consent_expiry_days,
|
||||
consent_mode,
|
||||
show_branding,
|
||||
@@ -331,6 +336,7 @@ INSERT INTO cookie_banners (
|
||||
origin,
|
||||
state,
|
||||
privacy_policy_url,
|
||||
cookie_policy_url,
|
||||
consent_expiry_days,
|
||||
consent_mode,
|
||||
show_branding,
|
||||
@@ -345,6 +351,7 @@ INSERT INTO cookie_banners (
|
||||
@origin,
|
||||
@state,
|
||||
@privacy_policy_url,
|
||||
@cookie_policy_url,
|
||||
@consent_expiry_days,
|
||||
@consent_mode,
|
||||
@show_branding,
|
||||
@@ -362,6 +369,7 @@ INSERT INTO cookie_banners (
|
||||
"origin": b.Origin,
|
||||
"state": b.State,
|
||||
"privacy_policy_url": b.PrivacyPolicyURL,
|
||||
"cookie_policy_url": b.CookiePolicyURL,
|
||||
"consent_expiry_days": b.ConsentExpiryDays,
|
||||
"consent_mode": b.ConsentMode,
|
||||
"show_branding": b.ShowBranding,
|
||||
@@ -394,6 +402,7 @@ SET
|
||||
name = @name,
|
||||
state = @state,
|
||||
privacy_policy_url = @privacy_policy_url,
|
||||
cookie_policy_url = @cookie_policy_url,
|
||||
consent_expiry_days = @consent_expiry_days,
|
||||
consent_mode = @consent_mode,
|
||||
show_branding = @show_branding,
|
||||
@@ -411,6 +420,7 @@ WHERE
|
||||
"name": b.Name,
|
||||
"state": b.State,
|
||||
"privacy_policy_url": b.PrivacyPolicyURL,
|
||||
"cookie_policy_url": b.CookiePolicyURL,
|
||||
"consent_expiry_days": b.ConsentExpiryDays,
|
||||
"consent_mode": b.ConsentMode,
|
||||
"show_branding": b.ShowBranding,
|
||||
|
||||
@@ -30,7 +30,8 @@ import (
|
||||
|
||||
type (
|
||||
CookieBannerVersionSnapshot struct {
|
||||
PrivacyPolicyURL string `json:"privacy_policy_url"`
|
||||
PrivacyPolicyURL *string `json:"privacy_policy_url,omitempty"`
|
||||
CookiePolicyURL string `json:"cookie_policy_url"`
|
||||
ConsentExpiryDays int `json:"consent_expiry_days"`
|
||||
ConsentMode string `json:"consent_mode"`
|
||||
DefaultLanguage string `json:"default_language"`
|
||||
|
||||
8
pkg/coredata/migrations/20260424T140000Z.sql
Normal file
8
pkg/coredata/migrations/20260424T140000Z.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Add cookie_policy_url (required) and make privacy_policy_url optional.
|
||||
-- Seed cookie_policy_url from existing privacy_policy_url for data continuity.
|
||||
|
||||
ALTER TABLE cookie_banners ADD COLUMN cookie_policy_url TEXT NOT NULL DEFAULT '';
|
||||
|
||||
UPDATE cookie_banners SET cookie_policy_url = privacy_policy_url WHERE cookie_policy_url = '';
|
||||
|
||||
ALTER TABLE cookie_banners ALTER COLUMN privacy_policy_url DROP NOT NULL;
|
||||
Reference in New Issue
Block a user