Commit 3e4013f2 authored by Felipe Artur's avatar Felipe Artur

Remove closing external issues by reference error

parent 2a8dec2c
...@@ -605,6 +605,8 @@ class MergeRequest < ActiveRecord::Base ...@@ -605,6 +605,8 @@ class MergeRequest < ActiveRecord::Base
self.merge_requests_closing_issues.delete_all self.merge_requests_closing_issues.delete_all
closes_issues(current_user).each do |issue| closes_issues(current_user).each do |issue|
next if issue.is_a?(ExternalIssue)
self.merge_requests_closing_issues.create!(issue: issue) self.merge_requests_closing_issues.create!(issue: issue)
end end
end end
......
---
title: Remove closing external issues by reference error
merge_request:
author:
type: fixed
...@@ -159,6 +159,7 @@ describe MergeRequest do ...@@ -159,6 +159,7 @@ describe MergeRequest do
before do before do
subject.project.has_external_issue_tracker = true subject.project.has_external_issue_tracker = true
subject.project.save! subject.project.save!
create(:jira_service, project: subject.project)
end end
it 'does not cache issues from external trackers' do it 'does not cache issues from external trackers' do
...@@ -166,6 +167,7 @@ describe MergeRequest do ...@@ -166,6 +167,7 @@ describe MergeRequest do
commit = double('commit1', safe_message: "Fixes #{issue.to_reference}") commit = double('commit1', safe_message: "Fixes #{issue.to_reference}")
allow(subject).to receive(:commits).and_return([commit]) allow(subject).to receive(:commits).and_return([commit])
expect { subject.cache_merge_request_closes_issues!(subject.author) }.not_to raise_error
expect { subject.cache_merge_request_closes_issues!(subject.author) }.not_to change(subject.merge_requests_closing_issues, :count) expect { subject.cache_merge_request_closes_issues!(subject.author) }.not_to change(subject.merge_requests_closing_issues, :count)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment