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) {
|
||||
e.preventDefault();
|
||||
$replyForm = $(e.target)
|
||||
if ($replyForm.children('textarea').val() == '') {
|
||||
return false
|
||||
}
|
||||
var submitButton = $replyForm.children('button')
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $replyForm.attr('action'),
|
||||
data: $replyForm.serialize(),
|
||||
beforeSend: function (xhr) {
|
||||
submitButton.prop('disabled', true)
|
||||
var token = $replyForm.data('token');
|
||||
xhr.setRequestHeader ("Authorization", 'Bearer '+token);
|
||||
},
|
||||
|
@ -808,6 +813,9 @@ function initVersions() {
|
|||
addToReviewHistory([json], container, true)
|
||||
$replyForm.children('textarea').val('')
|
||||
},
|
||||
complete: function() {
|
||||
submitButton.prop('disabled', false)
|
||||
},
|
||||
dataType: 'json'
|
||||
});
|
||||
return false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче