Problem/Motivation

On pages where a flag field is displayed, users who do not have permission to flag still download the flag library's JS files and their dependencies, even though no flag link is rendered for them.

Steps to reproduce

  1. Install Flag and create a node flag with link type AJAX link.
  2. Enable "Display link as field" and place the field in the node's view mode.
  3. Make sure the viewing role does not have the flag/unflag permission.
  4. View the node as that user and check the network tab.

Expected behavior: no flag JavaScript is loaded, since there is no flag link on the page.

Current behavior: flag-action_link_flash.js and its dependencies (like jQuery) load.

Proposed resolution

Attach the library only when the flag link is displayed.

Issue fork flag-3628869

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

alex.bukach created an issue. See original summary.

ivnish made their first commit to this issue’s fork.

  • ivnish committed 256103b6 on 5.1.x authored by alex.bukach
    fix: #3628869 The flag.link_ajax library is attached for users who...
ivnish’s picture

Assigned: alex.bukach » Unassigned
Status: Active » Fixed

Thanks, fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.