pull-requests: lock submit on pull request to prevent double submission on fast click.
This commit is contained in:
parent
27a87da295
commit
c3519ccca6
2 changed files with 8 additions and 3 deletions
|
|
@ -41,10 +41,10 @@ var prButtonLock = function(lockEnabled, msg, scope) {
|
|||
}
|
||||
var checksMeet = prButtonLockChecks.compare && prButtonLockChecks.reviewers;
|
||||
if (lockEnabled) {
|
||||
$('#save').attr('disabled', 'disabled');
|
||||
$('#pr_submit').attr('disabled', 'disabled');
|
||||
}
|
||||
else if (checksMeet) {
|
||||
$('#save').removeAttr('disabled');
|
||||
$('#pr_submit').removeAttr('disabled');
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
</div>
|
||||
<div class="input">
|
||||
<div class="pr-submit-button">
|
||||
${h.submit('save',_('Submit Pull Request'),class_="btn")}
|
||||
<input id="pr_submit" class="btn" name="save" type="submit" value="${_('Submit Pull Request')}">
|
||||
</div>
|
||||
<div id="pr_open_message"></div>
|
||||
</div>
|
||||
|
|
@ -171,6 +171,7 @@ $(function(){
|
|||
var defaultTargetRepoData = ${c.default_repo_data['target_refs_json']|n};
|
||||
|
||||
var $pullRequestForm = $('#pull_request_form');
|
||||
var $pullRequestSubmit = $('#pr_submit', $pullRequestForm);
|
||||
var $sourceRepo = $('#source_repo', $pullRequestForm);
|
||||
var $targetRepo = $('#target_repo', $pullRequestForm);
|
||||
var $sourceRef = $('#source_ref', $pullRequestForm);
|
||||
|
|
@ -510,6 +511,10 @@ $(function(){
|
|||
|
||||
});
|
||||
|
||||
$pullRequestForm.on('submit', function(e){
|
||||
prButtonLock(true, null, 'all');
|
||||
});
|
||||
|
||||
prButtonLock(true, "${_('Please select source and target')}", 'all');
|
||||
|
||||
// auto-load on init, the target refs select2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue