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
- Enable the module
- Configure at least two categories ie test1 and test2
- Set Consent Method to "Opt-in with categories"
- Check "Replace the Agree button with "Save preferences" and "Accept all categories" buttons."
- Check "Enable cookie(s) automatic-removal when consent isn't given."
- Enter a cookie for test2:some-cookie-name
- Open a browser window
- Check test1 and uncheck test2
- 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
Comment #2
pixelwhip commentedHere's a simple patch that adjusts the early return condition to allow blockCookies to continue running if the method is set to categories.
Comment #3
pixelwhip commentedComment #5
endrukk commentedI had the same issue, applied #1 and tested it with cookie categories.
Confirming that it's working as expected:
Opt-in with categories.
Opt-in.
Comment #6
avpadernoI 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.
Comment #7
svenryen commentedI ran into the same bug today, and can confirm this patch works.
We sadly don't have any test coverage in the module.
Comment #9
svenryen commentedMerged.