First of all, thank you for the awesome module! :)

Noticed this behaviour with 'Flag 7.x-3.x', using the 'Dialog Box' option with the 'Form' link type.

After a brief look (js debugging) it turned out that the selector for $wrapper in Drupal.flagUtils.updateContentIdLinks is invalid.

The cause of the problem is that template_preprocess_flag() outputs the following class on the flag link:

function template_preprocess_flag(&$variables) {
  // ... some code ...

  $flag_css_name = str_replace('_', '-', $flag->name);

  // ... some code ...

  $variables['flag_wrapper_classes_array'][] = 'flag-' . $flag_css_name . '-' . $entity_id;

  // ... some code ...
}

Then in the flagging_dialog.js file, the Drupal.flagUtils.updateContentIdLinks function uses the following as a selector for the wrapper to update:

var $wrappers = $('.flag-wrapper.flag-' + data.flagName + '-' + data.contentId);

It should instead look like the following (flag.js extends String: String.prototype.flagNameToCSS):

var $wrappers = $('.flag-wrapper.flag-' + data.flagName.flagNameToCSS() + '-' + data.contentId);

An example flag machine name that produces the above behaviour: comment_inappropriate.

I will create a patch and attach it soon!

Comments

temaruk’s picture

Issue summary: View changes

Added details.

temaruk’s picture

See the attached patch!

Coornail’s picture

Tested the patch, works like a charm!

misc’s picture

Status: Active » Reviewed & tested by the community
misc’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the latest dev.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Added details