Adds a setting that allows to reference/fix issues of all projects (#3087).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8750 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-02-02 18:09:37 +00:00
parent 3dc73dcb88
commit d02f6a8e32
49 changed files with 83 additions and 2 deletions

View File

@@ -187,11 +187,13 @@ class Changeset < ActiveRecord::Base
private
# Finds an issue that can be referenced by the commit message
# i.e. an issue that belong to the repository project, a subproject or a parent project
def find_referenced_issue_by_id(id)
return nil if id.blank?
issue = Issue.find_by_id(id.to_i, :include => :project)
if issue
if Setting.commit_cross_project_ref?
# all issues can be referenced/fixed
elsif issue
# issue that belong to the repository project, a subproject or a parent project only
unless issue.project &&
(project == issue.project || project.is_ancestor_of?(issue.project) ||
project.is_descendant_of?(issue.project))