]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6449 disable issues comment form during request
authorStas Vilchik <vilchiks@gmail.com>
Wed, 3 Jun 2015 07:46:56 +0000 (09:46 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 3 Jun 2015 07:47:04 +0000 (09:47 +0200)
server/sonar-web/src/main/js/components/issue/views/comment-form-view.js

index 4816ff2eada7f61322311c9912be880c7af3210a..8596d99223a16a77c8ca1ab0a1ee8ab416cfad95 100644 (file)
@@ -49,6 +49,14 @@ define([
       this.options.detailView.updateAfterAction(false);
     },
 
+    disableForm: function () {
+      this.$(':input').prop('disabled', true);
+    },
+
+    enableForm: function () {
+      this.$(':input').prop('disabled', false);
+    },
+
     submit: function () {
       var that = this;
       var text = this.ui.textarea.val(),
@@ -61,9 +69,13 @@ define([
       } else {
         data.issue = this.options.issue.id;
       }
-      return $.post(url, data).done(function () {
-        that.options.detailView.updateAfterAction(true);
-      });
+      this.disableForm();
+      return $.post(url, data)
+          .done(function () {
+            that.options.detailView.updateAfterAction(true);
+          }).fail(function () {
+            that.enableForm();
+          });
     }
   });