Skip to content

Commit

Permalink
Merge pull request #8876 from dmarcoux/issue-8872
Browse files Browse the repository at this point in the history
Cancel Ajax call when there are only duplicated issues
  • Loading branch information
DavidKang committed Dec 16, 2019
2 parents 11e0321 + e99244e commit 8af3af1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/api/app/assets/javascripts/webui/patchinfo.js
Expand Up @@ -14,10 +14,6 @@ function addIssuesAjaxBefore() {
return false;
}

var element = $(this);
element.children('i.fas.fa-plus-circle').addClass('d-none');
element.children('i.fas.fa-spin').removeClass('d-none');

issues = $.unique(issues.replace(/ /g, '').split(','));

var currentIssues = $('[name="patchinfo[issueid][]"]').map(function(_, element) {
Expand All @@ -33,6 +29,14 @@ function addIssuesAjaxBefore() {
return currentIssues.indexOf(issue) === -1;
});

if (issues.length === 0) {
$('#issue_ids').val('');
return false;
}

var element = $(this);
element.children('i.fas.fa-plus-circle').addClass('d-none');
element.children('i.fas.fa-spin').removeClass('d-none');
element.data('params', { issues: issues, project: element.data('project') });
});
}
Expand Down
1 change: 1 addition & 0 deletions src/api/app/controllers/webui/patchinfo_controller.rb
Expand Up @@ -89,6 +89,7 @@ def new_tracker
error = ''
invalid_format = ''
# params[:issues] = list of new issues to add
params[:issues] ||= []
params[:issues].each do |new_issue|
issue = IssueTracker::IssueTrackerHelper.new(new_issue)
if issue.valid?
Expand Down

0 comments on commit 8af3af1

Please sign in to comment.