From 24c556683c1ee7871289cded0adcc02f8950c9cc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 18 2015 11:04:28 +0000 Subject: Fix the JS logic in the issue template to allow deleting a comment --- diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 9f0e55c..831ef15 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -357,7 +357,14 @@ source.addEventListener('message', function(e) { {% if authenticated and form %} function try_async_comment(form) { - $.post( form.action + "?js=1", $(form).serialize() ) + var _url = form.action + "?js=1"; + var _data = $(form).serialize(); + var btn = $(document.activeElement); + if (btn[0].value){ + _data += '&drop_comment=' + btn[0].value; + return true; + } + $.post( _url, _data ) .done(function(data) { if(data == 'ok') { {# The event-source server will automatically refresh the UI #}