From 1a1f7898b3bcd8b1156a37a0d1acfb6c8b8a6bd0 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Nov 22 2018 08:35:18 +0000 Subject: Prevent double click from showing two input form Previously, if the server was busy and you would click twice on the button to add an inline comment, you could end up with two (or more!) input forms showing up for this line in the diff. This effectively disables the button until it is known that the user can now asks for more forms to submit more comments. Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/templates/repo_pull_request.html b/pagure/templates/repo_pull_request.html index 92455f1..f7007e8 100644 --- a/pagure/templates/repo_pull_request.html +++ b/pagure/templates/repo_pull_request.html @@ -967,6 +967,11 @@ $(document).ready(function() { $( ".prc" ).click( function() { + var disabled = $('.prc').attr('disabled'); + if (disabled === true || disabled == "disabled") { + return false; + } + $(".prc").attr("disabled","disabled"); var row = $( this ).attr('data-row'); var commit = $( this ).attr('data-commit'); var filename = $( this ).attr('data-filename'); @@ -999,10 +1004,12 @@ $(document).ready(function() {
' + data + '
' ); cancel_edit_btn(); + $(".prc").removeAttr("disabled"); emoji_complete(json_url, folder); }); } else { next_row.prev().find('.pr_comment_form').parent().remove(); + $(".prc").removeAttr("disabled"); } } );