Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tassilogroeper created an issue. See original summary.

tassilogroeper’s picture

svenryen’s picture

Good point. Thanks for the patch!

tassilogroeper’s picture

Sorry, forgot about the JS call to the "euCookieComplianceLoadScripts" function.

svenryen’s picture

Thanks. I'll take a look later.

DuaelFr’s picture

Assigned: tassilogroeper » Unassigned
Status: Active » Needs work

Hi there!
That's a very good point. Those empty styles and scripts should be avoided when not necessary.
The #4 is almost good except for the following:

+++ b/eu_cookie_compliance.module
@@ -299,15 +299,20 @@ function eu_cookie_compliance_page_attachments(&$attachments) {
+    if (empty($data['css'])) {
+      return;
+    }

You can't do this as there is some unrelated code that should be run after this attachment! (lines 322 to 340)
You should wrap the attachment creation as you did with the previous one.

DuaelFr’s picture

Status: Needs work » Needs review
FileSize
2.6 KB
1.24 KB

Fixed #6

Status: Needs review » Needs work

The last submitted patch, 7: eu_cookie_compliance_remove_empty_tags-2995558-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

DuaelFr’s picture

Status: Needs work » Needs review

The coding standards test failures are not related to the attached patch.

sasanikolic’s picture

+++ b/eu_cookie_compliance.module
@@ -299,25 +299,29 @@ function eu_cookie_compliance_page_attachments(&$attachments) {
diff --git a/js/eu_cookie_compliance.js b/js/eu_cookie_compliance.js

+++ b/js/eu_cookie_compliance.js
@@ -246,7 +246,7 @@
+    if (!euCookieComplianceHasLoadedScripts && typeof euCookieComplianceLoadScripts === "function") {

Why is this check really needed? Can we try to avoid that?

Bès’s picture

Patch Reroll on the 8.x-1.3 module version

Status: Needs review » Needs work
svenryen’s picture

Status: Needs work » Needs review
svenryen’s picture

We would also need a patch for d7.

Bès’s picture

Status: Needs review » Needs work
svenryen’s picture

Status: Needs work » Needs review
svenryen’s picture

+++ b/eu_cookie_compliance.module
@@ -333,25 +333,29 @@ function eu_cookie_compliance_page_attachments(&$attachments) {
+      $cache_tags = isset($attachments['#cache']['tags']) ? $attachments['#cache']['tags'] : [];
+      $attachments['#cache']['tags'] = Cache::mergeTags($cache_tags, $config->getCacheTags());

I'm not sure this code on line 357 and 358 in the patch should be excluded when there is no css config. To me this doesn't seem right. Those lines were introduced in #2669028: No cache invalidation when settings change. and are not related to the css issue at hand.

Do you have any details, @Bès or @DuaelFr?

Rodlangh’s picture

Patch Reroll on the 8.x-1.6 module version.

Altered the patch according to the comment by @svenryen. Seems to me the cache tags should always be included?
Added an extra check in the js file: savePreferencesAction method also loads the scripts.

Status: Needs review » Needs work
Berdir’s picture

Status: Needs work » Reviewed & tested by the community

Looks good now, I think. Agreed that the cache tags need to be outside.

svenryen’s picture

Thanks for the review. I'll commit later.

svenryen’s picture

There was a script load related to the new categories feature that the patch in #19 didn't cover. I added an additional check there, as I think the script would otherwise fail.

Also, patch parted to D7 is attached.

@Berdir, are you free to review this patch again?

svenryen’s picture

Status: Reviewed & tested by the community » Needs review

  • svenryen authored 1451ea8 on 8.x-1.x
    Issue #2995558 by svenryen, tassilogroeper, Bès, DuaelFr, Rodlangh,...

  • svenryen authored 1a35400 on 7.x-1.x
    Issue #2995558 by svenryen, tassilogroeper, Bès, DuaelFr, Rodlangh,...
svenryen’s picture

Status: Needs review » Fixed

Since the added code in #23 was minimal (barely adding another check on the existence of the function), I'll go ahead and commit these changes. Thanks to all who helped.

  • svenryen authored d17dd79 on 8.x-1.x
    Issue #2995558 by svenryen, tassilogroeper, Bès, DuaelFr, Rodlangh,...

  • svenryen authored d2271ae on 7.x-1.x
    Issue #2995558 by svenryen, tassilogroeper, Bès, DuaelFr, Rodlangh,...
DuaelFr’s picture

Thank you for your work on this much useful module! :)

  • svenryen authored 1a35400 on 7.x-2.x
    Issue #2995558 by svenryen, tassilogroeper, Bès, DuaelFr, Rodlangh,...
  • svenryen authored d2271ae on 7.x-2.x
    Issue #2995558 by svenryen, tassilogroeper, Bès, DuaelFr, Rodlangh,...

Status: Fixed » Closed (fixed)

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