Commit b40e04de authored by Istvan Reszler-Fekete's avatar Istvan Reszler-Fekete Committed by Sven Berg Ryen
Browse files

Issue #3170219 by reszli, svenryen, PieterDC: [1.x][2.0.x] Option to retrigger...

Issue #3170219 by reszli, svenryen, PieterDC: [1.x][2.0.x] Option to retrigger popup instead of trying to prevent it when no policy version is set
parent bf18cf43
Loading
Loading
Loading
Loading
+7 −6
Changes for js/eu_cookie_compliance.js: 7 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -96,14 +96,15 @@
      _euccCurrentStatus = Drupal.eu_cookie_compliance.getCurrentStatus();

      if (typeof Drupal.eu_cookie_compliance.getVersion() === 'undefined') {
        // If version doesn't exist as a cookie, set it to the current one.
        // For modules that update to this, it prevents needless retriggering
        // If version doesn't exist as a cookie, set it to a default one.
        // For sites who update to this version of the module, it helps to
        // re-trigger the popup in case you switched to category based consent.
        // For first time runs, it makes no difference as the other IF statements
        // below will still cause the popup to trigger
        // For incrementing the version, it also makes no difference as either it's
        // a returning user and will have a version set, or it's a new user and
        // the other checks will trigger it.
        Drupal.eu_cookie_compliance.setVersion();
        Drupal.eu_cookie_compliance.setVersion("unknown");
      }

      var versionChanged = Drupal.eu_cookie_compliance.getVersion() !== drupalSettings.eu_cookie_compliance.cookie_policy_version;
@@ -838,7 +839,7 @@
  };

  Drupal.eu_cookie_compliance.hasAgreed = function (category) {
    var agreed = (_euccCurrentStatus === cookieValueAgreedShowThankYou || _euccCurrentStatus === cookieValueAgreed);
    var agreed = (parseInt(_euccCurrentStatus) === cookieValueAgreedShowThankYou || parseInt(_euccCurrentStatus) === cookieValueAgreed);

    if (category !== undefined && agreed) {
      agreed = Drupal.eu_cookie_compliance.hasAgreedWithCategory(category);
@@ -941,7 +942,7 @@
    return cookies.get(cookieName);
  };

  Drupal.eu_cookie_compliance.setVersion = function () {
  Drupal.eu_cookie_compliance.setVersion = function (force_this_version) {
    // Only set cookie-agreed-version version cookie, if user agreed.
    if (!Drupal.eu_cookie_compliance.hasAgreed()) {
      return false;
@@ -958,7 +959,7 @@
      }
    }

    var eucc_version = drupalSettings.eu_cookie_compliance.cookie_policy_version;
    var eucc_version = (force_this_version !== undefined) ? force_this_version : drupalSettings.eu_cookie_compliance.cookie_policy_version;
    var cookie_session = parseInt(drupalSettings.eu_cookie_compliance.cookie_session);
    if (cookie_session) {
      cookies.set(cookieName, eucc_version, { path: path, domain: domain, sameSite: 'strict' });