Hi,

While I was trying the module like_and_dislike alpha2 on a content node being an anonymous user, I've encountered the JavaScript issue like_and_dislike.js:30 Uncaught ReferenceError: Drupal is not define when I tried to visit a node with the poll enabled.

Steps to reproduce the issue:

  • Enable like/dislike on a content node
  • Give to anonymous the right permissions to make a vote
  • Make the like/dislike visible on the node display
  • As anonymous user, try to visit a node where the poll is visible
  • You will not be able to vote due to a JS error in console

To fix this isse it's only needed to add the right dependencies in the library definition:

  • core/jquery.once
  • core/drupal

This issue also affects the dev version.

Patch attached.

CommentFileSizeAuthor
#2 drupal_is_not_defined-2835043-1.patch354 bytesaless_io

Comments

aless_io created an issue. See original summary.

aless_io’s picture

Issue summary: View changes
StatusFileSize
new354 bytes
aless_io’s picture

Issue summary: View changes
benjifisher’s picture

Status: Active » Needs review

@aless_io:

Since you supplied a patch, you should mark the issue as "Needs Review" (NR). That signals the module maintainer (and anyone else prowling the issues queue) that it is ready for testing.

I have been using this module with anonymous voters, and I have not run into this problem. Maybe that is simply because my site already has the required libraries loaded.

bstumbo’s picture

Status: Needs review » Reviewed & tested by the community

Had this exact issue and the patch worked. Though I did have to apply the patch manually for some reason.

keshavv’s picture

@aless_io Thanks you save my Time.

adriancid’s picture

Title: JavaScript error: Drupal is not defined when anonymous » Javascript libraries are not defined for anonymous users
Version: 8.x-1.0-alpha2 » 8.x-1.x-dev

  • adriancid committed 4ca2223 on 8.x-1.x authored by aless_io
    Issue #2835043 by aless_io, benjifisher, bstumbo, keshav.k, adriancid:...
adriancid’s picture

Status: Reviewed & tested by the community » Fixed
adriancid’s picture

Thanks @all for the work :-)

Status: Fixed » Closed (fixed)

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