diff --git a/plugins/CoreAdminHome/OptOutManager.php b/plugins/CoreAdminHome/OptOutManager.php index 50f4b75dae6..b8f3ee90045 100644 --- a/plugins/CoreAdminHome/OptOutManager.php +++ b/plugins/CoreAdminHome/OptOutManager.php @@ -527,7 +527,7 @@ function showContent(consent, errorMessage = null, useTracker = false) { this.setCookie(this.CONSENT_COOKIE_NAME, '', -129600000); return false; } - return (consentCookie || consentCookie !== 0); + return !!(consentCookie && consentCookie !== 0); }, consentGiven: function() { this.setCookie(this.CONSENT_REMOVED_COOKIE_NAME, '', -129600000); diff --git a/tests/UI/specs/OptOutJS_spec.js b/tests/UI/specs/OptOutJS_spec.js index 154c356eadb..100594cbca4 100644 --- a/tests/UI/specs/OptOutJS_spec.js +++ b/tests/UI/specs/OptOutJS_spec.js @@ -18,7 +18,7 @@ describe('OptOutJS', function () { if (useTracker) { hasConsent = await page.evaluate(() => window.Matomo.getTracker().hasConsent()); } else { - hasConsent = await page.evaluate(() => !!window.MatomoConsent.hasConsent()); + hasConsent = await page.evaluate(() => window.MatomoConsent.hasConsent()); } expect(hasConsent).to.equal(expectedState);