Disable activity reply form submit during submission to avoid dupe replies (#4905)
This commit is contained in:
Родитель
96cd25ae04
Коммит
fc43673298
|
@ -794,11 +794,16 @@ function initVersions() {
|
||||||
$(".dev-review-reply-form").submit(function (e) {
|
$(".dev-review-reply-form").submit(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$replyForm = $(e.target)
|
$replyForm = $(e.target)
|
||||||
|
if ($replyForm.children('textarea').val() == '') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
var submitButton = $replyForm.children('button')
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: $replyForm.attr('action'),
|
url: $replyForm.attr('action'),
|
||||||
data: $replyForm.serialize(),
|
data: $replyForm.serialize(),
|
||||||
beforeSend: function (xhr) {
|
beforeSend: function (xhr) {
|
||||||
|
submitButton.prop('disabled', true)
|
||||||
var token = $replyForm.data('token');
|
var token = $replyForm.data('token');
|
||||||
xhr.setRequestHeader ("Authorization", 'Bearer '+token);
|
xhr.setRequestHeader ("Authorization", 'Bearer '+token);
|
||||||
},
|
},
|
||||||
|
@ -808,6 +813,9 @@ function initVersions() {
|
||||||
addToReviewHistory([json], container, true)
|
addToReviewHistory([json], container, true)
|
||||||
$replyForm.children('textarea').val('')
|
$replyForm.children('textarea').val('')
|
||||||
},
|
},
|
||||||
|
complete: function() {
|
||||||
|
submitButton.prop('disabled', false)
|
||||||
|
},
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче