Details
-
Bug
-
Status: Done
-
High
-
Resolution: Fixed
-
5.3.2, 5.3.2-rc5
-
None
-
None
-
0.7
Description
We make use of the script fragments that show a dialog - and in 5.3.2-rc5 the dialog is appearing twice. The web item provider seems to be unaffected - it's just the web item fragment that is executing twice per button click.
Steps to repro:
1.Create a rest endpoint with this code:
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate import groovy.transform.BaseScript import javax.ws.rs.core.MediaType import javax.ws.rs.core.MultivaluedMap import javax.ws.rs.core.Response @BaseScript CustomEndpointDelegate delegate dialogTest(httpMethod: "GET") { MultivaluedMap queryParams -> def dialog = """<section role="dialog" id="sr-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" aria-hidden="true" data-aui-remove-on-hide="true"> <header class="aui-dialog2-header"> <h2 class="aui-dialog2-header-main">One of two dialogs</h2> <a class="aui-dialog2-header-close"> <span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span> </a> </header> <div class="aui-dialog2-content"> <p>Body </div> <footer class="aui-dialog2-footer"> <div class="aui-dialog2-footer-actions"> <button id="dialog-submit" class="aui-button aui-button-link">Submit</button> </div> <div class="aui-dialog2-footer-hint">Hint</div> </footer> <script> AJS.\$("#dialog-submit").click(function(e) { console.log('Submitting...'); AJS.dialog2("#sr-dialog").hide(); }); </script> </section> """ Response.ok().type(MediaType.TEXT_HTML).entity(dialog.toString()).build() }
2. Create a custom web item with the following configuration:
3. Go to an issue, you should see your button displayed like so:
4. When you click the button, you will see this dialog:
5. If you examine the html, at the very bottom you will see that there are two dialogs with the exact name id.
6. You will need to click twice in the close cross to remove them completely.