mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Prioritize widget-provided cookie consent information over localStorage (Z#23181715) (#4862)
* Prioritize widget-provided cookie consent information over localStorage * Hide cookie-consent-reopen link if external consent info from widget present
This commit is contained in:
@@ -31,7 +31,16 @@ $(function () {
|
||||
var show_dialog = !storage_val;
|
||||
var consent_checkboxes = $("#cookie-consent-details input[type=checkbox][name]");
|
||||
var consent_modal = $("#cookie-consent-modal");
|
||||
if (storage_val) {
|
||||
var widget_consent = $("#cookie-consent-from-widget").text();
|
||||
if (widget_consent) {
|
||||
widget_consent = JSON.parse(widget_consent);
|
||||
storage_val = {}
|
||||
consent_checkboxes.each(function () {
|
||||
this.checked = storage_val[this.name] = widget_consent.indexOf(this.name) > -1;
|
||||
})
|
||||
show_dialog = false;
|
||||
$("#cookie-consent-reopen").hide();
|
||||
} else if (storage_val) {
|
||||
storage_val = JSON.parse(storage_val);
|
||||
consent_checkboxes.each(function () {
|
||||
if (typeof storage_val[this.name] === "undefined") {
|
||||
@@ -43,14 +52,6 @@ $(function () {
|
||||
})
|
||||
} else {
|
||||
storage_val = {}
|
||||
var consented = $("#cookie-consent-from-widget").text();
|
||||
if (consented) {
|
||||
consented = JSON.parse(consented);
|
||||
consent_checkboxes.each(function () {
|
||||
this.checked = storage_val[this.name] = consented.indexOf(this.name) > -1;
|
||||
})
|
||||
show_dialog = false
|
||||
}
|
||||
}
|
||||
update_consent(storage_val);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user