The collector script is retrieved on page load, but not executed (see screenshot):

In jira_issue_collector.js, the script is retrieved but never runs, while the $.ajax() call returns a success status every time. I've tried various permutations of $.getScript, $.ajax, etc all to no avail.
It seems like this could be an issue with Drupal.behaviors, as embedding the 'Embed in JavaScript' snippet from Jira (bypassing jira_issue_collector.js entirely) directly does work. This isn't ideal though as it doesn't get attached for ajax requests and such.
Verified on simplytest.me with v7.x-1.1 and the regex patch from https://www.drupal.org/node/2416467.
Comments
Comment #1
robwilmshurst commentedComment #2
robwilmshurst commentedWorkaround patch attached (this is by no means a full solution however).
Comment #3
robwilmshurst commentedJust re-read https://www.drupal.org/node/2378253 and it's a similar issue to this. If the locale parameter is present in the script URL, the collector is never displayed.
I think this is actually a Jira issue, rather than an issue with the regex in
jira_issue_collector_admin_settings_form_validate, as it doesn't actually change the URL. Possibly related to https://jira.atlassian.com/browse/JRA-38562.Maybe we just need to tweak the documentation for this module to clarify the issues with the locale parameter?
Comment #4
arpieb commentedI've confirmed the URL produced by JIRA v6.3.13#6344-sha1:62d2b41 is correctly formed, and does return a valid JS file. However the jQuery.ajax() call is completing "successfully" yet not executing the script file correctly.
Going with the concept in #2429389-2: Collector script not executed above, I've rolled a bit cleaner patch. The reason for the update is that the embed script accepted by the module's config page could be one of two formats, and will result in a failure if the wrong one is used. This patch simply adds the external JS URL to the page load via drupal_add_js() instead of assuming the embed format is correct as provided by the admin.
Comment #5
robwilmshurst commentedThis seems like a cleaner approach - and is working for me, thanks.
Comment #6
arpieb commentedSetting for "needs review."
Comment #9
jdelon02 commentedHello,
This is my first time doing this, so I have no idea if I am doing it correctly. I was having a problem (which seems to match the bug described here), where the script gets loaded, but it does not run. I had no button, so no action could be taken. I have created a patch for this that works on my local environment.
Jeremy
Comment #10
kaidjohnson commentedI think the approach taken in #4 is the way to go. I've re-rolled the patch to drop the now unused javascript file and update the tests accordingly. Also added 'defer' to the drupal_add_js definition to ensure loading the feedback doesn't block page load, which is what I believe was the original intention of using jQuery.ajax().
Bumping this up to critical for obvious reasons.
Comment #11
kasperg commentedThanks for chiming in everybody. This issue has been flying under the radar for quite some time.
I just released a new version of the module, 1.3, which should fix this issue. The updated version still uses the current approach with Drupal.behaviors but only supports the JavaScript embed format as this caused the original problem regarding the issue collector not loading.
Comment #12
jkcrosby3 commentedRecent update actually makes Feedback button appear so it can be used, so that is great! Thanks!
2 Issues:
Comment #13
kasperg commentedjkcrosby3:
In general these are separate from the original concern. If you want to discuss them further please create new issues.