Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Burgess <88810029+bx80@users.noreply.github.com>2022-11-07 00:44:26 +0300
committerGitHub <noreply@github.com>2022-11-07 00:44:26 +0300
commit761029bff50c2fe73242f9536d0473f3e76537ed (patch)
treed0533572d6162dc3bb37174e2867d71200321b2f
parent0948bb6457c5566fc6cc1533d93e54a1f335c7ca (diff)
Fix for opt-out toggling on page load, fix for defaulting to opted out state if no cookies found (#19915)
-rw-r--r--plugins/CoreAdminHome/OptOutManager.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/plugins/CoreAdminHome/OptOutManager.php b/plugins/CoreAdminHome/OptOutManager.php
index eba6b88f6a..09e192bc35 100644
--- a/plugins/CoreAdminHome/OptOutManager.php
+++ b/plugins/CoreAdminHome/OptOutManager.php
@@ -355,10 +355,8 @@ HTML;
_paq.push(['setCookiePath', settings.cookiePath]);
}
if (this.isUserOptedOut()) {
- _paq.push(['forgetUserOptOut']);
showContent(false, null, true);
} else {
- _paq.push(['optUserOut']);
showContent(true, null, true);
}
}]);
@@ -456,12 +454,16 @@ JS;
}
},
hasConsent: function() {
- var value = this.getCookie(this.CONSENT_COOKIE_NAME);
- if (this.getCookie(this.CONSENT_REMOVED_COOKIE_NAME) && value) {
+ var consentCookie = this.getCookie(this.CONSENT_COOKIE_NAME);
+ var removedCookie = this.getCookie(this.CONSENT_REMOVED_COOKIE_NAME);
+ if (!consentCookie && !removedCookie) {
+ return true; // No cookies set, so opted in
+ }
+ if (removedCookie && consentCookie) {
this.setCookie(this.CONSENT_COOKIE_NAME, '', -129600000);
return false;
}
- return (value || value !== 0);
+ return (consentCookie || consentCookie !== 0);
},
consentGiven: function() {
this.setCookie(this.CONSENT_REMOVED_COOKIE_NAME, '', -129600000);