Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-06-12 08:39:50 +0300
committerStan Hu <stanhu@gmail.com>2015-06-12 16:59:27 +0300
commitd45112258e066da307975c17c5ca19ea9a17222b (patch)
treeff77b6428f81f9d97f330c821eb8b46a4389386b /app/services
parent4e98159022c99d3fd857fc35015547fd93d830be (diff)
Fix post-receive errors on a push when an external issue tracker is configured
Closes #1700 Closes #1720
Diffstat (limited to 'app/services')
-rw-r--r--app/services/git_push_service.rb26
-rw-r--r--app/services/issues/close_service.rb2
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)