Ignore external issues when bulk assigning issues to author of merge request.
Fixes #23552
This commit is contained in:
parent
2510345ee5
commit
23e81bfde8
2 changed files with 13 additions and 1 deletions
|
@ -4,7 +4,7 @@ module MergeRequests
|
|||
@assignable_issues ||= begin
|
||||
if current_user == merge_request.author
|
||||
closes_issues.select do |issue|
|
||||
!issue.assignee_id? && can?(current_user, :admin_issue, issue)
|
||||
!issue.is_a?(ExternalIssue) && !issue.assignee_id? && can?(current_user, :admin_issue, issue)
|
||||
end
|
||||
else
|
||||
[]
|
||||
|
|
|
@ -46,4 +46,16 @@ describe MergeRequests::AssignIssuesService, services: true do
|
|||
it 'assigns these to the merge request owner' do
|
||||
expect { service.execute }.to change { issue.reload.assignee }.to(user)
|
||||
end
|
||||
|
||||
it 'ignores external issues' do
|
||||
external_issue = ExternalIssue.new('JIRA-123', project)
|
||||
service = described_class.new(
|
||||
project,
|
||||
user,
|
||||
merge_request: merge_request,
|
||||
closes_issues: [external_issue]
|
||||
)
|
||||
|
||||
expect(service.assignable_issues.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue