diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-06-22 16:00:41 +0000 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-06-22 16:00:41 +0000 |
commit | 1d4266f9aa1dace96b8867e6a157c6b701d34996 (patch) | |
tree | 4629c60d813dd4625d7b36549e690e3e5f271468 /app | |
parent | baa699a75a0010ceab6eb4c3ed732b610ec5d3a5 (diff) | |
parent | a96f3e1803d02654b3bf28e0fe54935d19b2ffb3 (diff) | |
download | gitlab-ce-1d4266f9aa1dace96b8867e6a157c6b701d34996.tar.gz |
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
Diffstat (limited to 'app')
-rw-r--r-- | app/services/git_push_service.rb | 26 | ||||
-rw-r--r-- | app/services/issues/close_service.rb | 2 |
2 files changed, 17 insertions, 11 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index cde65349d5c..68d3b915fc9 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -88,18 +88,24 @@ class GitPushService 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 diff --git a/app/services/issues/close_service.rb b/app/services/issues/close_service.rb index 138465859ce..3d85f97b7e5 100644 --- a/app/services/issues/close_service.rb +++ b/app/services/issues/close_service.rb @@ -1,7 +1,7 @@ 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) |