Problem/Motivation

When the module is configured with categories and to automatically remove cookies when consent isn't given, categories are not taken into account when deciding which cookies to delete. My apologies if I'm misunderstanding how this should work.

Steps to reproduce

  1. Enable the module
  2. Configure at least two categories ie test1 and test2
  3. Set Consent Method to "Opt-in with categories"
  4. Check "Replace the Agree button with "Save preferences" and "Accept all categories" buttons."
  5. Check "Enable cookie(s) automatic-removal when consent isn't given."
  6. Enter a cookie for test2:some-cookie-name
  7. Open a browser window
  8. Check test1 and uncheck test2
  9. Click "Save Preferences"

Expected Result

test2:some-cookie-name should be deleted when blockCookies executes

Observed Result

test2:some-cookie-name does not get deleted.

Proposed resolution

The blockCookies method will abort if the currentStatus is 1 or 2. This does not allow cookies to be blocked on a category basis if preferences change. Allow the blockCookies method to execute if the status is set to 1 or 2 but the method is "categories".

Comments

pixelwhip created an issue. See original summary.

pixelwhip’s picture

Here's a simple patch that adjusts the early return condition to allow blockCookies to continue running if the method is set to categories.

pixelwhip’s picture

Status: Active » Needs review

Status: Needs review » Needs work
endrukk’s picture

I had the same issue, applied #1 and tested it with cookie categories.
Confirming that it's working as expected:

Opt-in with categories.

  • • When the cookie category is NOT agreed the cookies belonging to the category are removed automatically
  • • When the cookie category is AGREED the cookies belonging to the category aren't removed

Opt-in.

  • • When consent NOT given cookies are removed automatically
  • • When consent given cookies aren't removed
avpaderno’s picture

Version: 8.x-1.14 » 8.x-1.x-dev

I could be wrong, but from the test results, I get the module doesn't provide tests, and that is the only reported error.
The patch applies without errors, but without tests, it's not possible to know if the patch is correct, except by manually verifying it.

svenryen’s picture

Status: Needs work » Reviewed & tested by the community

I ran into the same bug today, and can confirm this patch works.

We sadly don't have any test coverage in the module.

  • svenryen committed a0dacb3 on 8.x-1.x
    Issue #3192023 by pixelwhip, endrukk, kiamlaluno, svenryen: Automatic...
svenryen’s picture

Status: Reviewed & tested by the community » Fixed

Merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.