Skip to content
Snippets Groups Projects
Commit 1d4266f9 authored by Jacob Vosmaer (GitLab)'s avatar Jacob Vosmaer (GitLab)
Browse files

Merge branch '7-12-fix-post-receive-external-tracker' into '7-12-stable'

Fix post-receive errors on a push when an external issue tracker is configured

Closes #1700
Closes #1720

See merge request !855
parents baa699a7 a96f3e18
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -13,6 +13,7 @@ v 7.13.0 (unreleased)
v 7.12.0 (unreleased)
- Fix Error 500 when one user attempts to access a personal, internal snippet (Stan Hu)
- Disable changing of target branch in new merge request page when a branch has already been specified (Stan Hu)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
- Update oauth button logos for Twitter and Google to recommended assets
- Update browser gem to version 0.8.0 for IE11 support (Stan Hu)
- Fix timeout when rendering file with thousands of lines.
Loading
Loading
Loading
Loading
@@ -88,18 +88,24 @@ def process_commit_messages(ref)
end
end
 
# Create cross-reference notes for any other references. Omit any issues that were referenced in an
# issue-closing phrase, or have already been mentioned from this commit (probably from this commit
# being pushed to a different branch).
refs = commit.references(project, user) - issues_to_close
refs.reject! { |r| commit.has_mentioned?(r) }
if project.default_issues_tracker?
create_cross_reference_notes(commit, issues_to_close)
end
end
end
 
if refs.present?
author ||= commit_user(commit)
def create_cross_reference_notes(commit, issues_to_close)
# Create cross-reference notes for any other references. Omit any issues that were referenced in an
# issue-closing phrase, or have already been mentioned from this commit (probably from this commit
# being pushed to a different branch).
refs = commit.references(project, user) - issues_to_close
refs.reject! { |r| commit.has_mentioned?(r) }
 
refs.each do |r|
Note.create_cross_reference_note(r, commit, author)
end
if refs.present?
author ||= commit_user(commit)
refs.each do |r|
Note.create_cross_reference_note(r, commit, author)
end
end
end
Loading
Loading
module Issues
class CloseService < Issues::BaseService
def execute(issue, commit = nil)
if issue.close
if project.default_issues_tracker? && issue.close
event_service.close_issue(issue, current_user)
create_note(issue, commit)
notification_service.close_issue(issue, current_user)
Loading
Loading
Loading
Loading
@@ -233,6 +233,15 @@
 
expect(Issue.find(issue.id)).to be_opened
end
it "doesn't close issues when external issue tracker is in use" do
allow(project).to receive(:default_issues_tracker?).and_return(false)
# The push still shouldn't create cross-reference notes.
expect {
service.execute(project, user, @oldrev, @newrev, 'refs/heads/hurf')
}.not_to change { Note.where(project_id: project.id, system: true).count }
end
end
 
describe "empty project" do
Loading
Loading
Loading
Loading
@@ -31,5 +31,15 @@
expect(note.note).to include "Status changed to closed"
end
end
context "external issue tracker" do
before do
allow(project).to receive(:default_issues_tracker?).and_return(false)
@issue = Issues::CloseService.new(project, user, {}).execute(issue)
end
it { expect(@issue).to be_valid }
it { expect(@issue).to be_opened }
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment