From ccf24581e2de42c829513b6270eac15bb0c0e9e7 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 3 Jun 2015 09:46:56 +0200 Subject: [PATCH] SONAR-6449 disable issues comment form during request --- .../issue/views/comment-form-view.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js b/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js index 4816ff2eada..8596d99223a 100644 --- a/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js +++ b/server/sonar-web/src/main/js/components/issue/views/comment-form-view.js @@ -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(); + }); } }); -- 2.39.5