diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-11-20 12:07:28 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-11-20 12:07:28 +0000 |
commit | 99f9aea80a2bc43cdfc2933728f0ab72d7bf99d5 (patch) | |
tree | 840e11fa2d5d72dac774069417e1ad30ce895072 /app | |
parent | deb182337d14872c5481059382459f5c21502162 (diff) | |
download | redmine-99f9aea80a2bc43cdfc2933728f0ab72d7bf99d5.tar.gz redmine-99f9aea80a2bc43cdfc2933728f0ab72d7bf99d5.zip |
* Referencing issues in commit messages: enter * in 'Referencing keywords' to link any issue id without using keywords.
* Updated Polish translation (Mariusz Olejnik).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@918 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 2 | ||||
-rw-r--r-- | app/models/changeset.rb | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 80694e744..9c8e9c67d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -231,7 +231,7 @@ module ApplicationHelper # example: # #52 -> <a href="/issues/show/52">#52</a> # r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (project.id is 6) - text = text.gsub(%r{([\s,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m| + text = text.gsub(%r{([\s\(,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m| leading, otype, oid = $1, $2, $3 link = nil if otype == 'r' diff --git a/app/models/changeset.rb b/app/models/changeset.rb index e4e221732..355a5754c 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -63,6 +63,14 @@ class Changeset < ActiveRecord::Base return if kw_regexp.blank? referenced_issues = [] + + if ref_keywords.delete('*') + # find any issue ID in the comments + target_issue_ids = [] + comments.scan(%r{([\s\(,-^])#(\d+)(?=[[:punct:]]|\s|<|$)}).each { |m| target_issue_ids << m[1] } + referenced_issues += repository.project.issues.find_all_by_id(target_issue_ids) + end + comments.scan(Regexp.new("(#{kw_regexp})[\s:]+(([\s,;&]*#?\\d+)+)", Regexp::IGNORECASE)).each do |match| action = match[0] target_issue_ids = match[1].scan(/\d+/) @@ -80,6 +88,7 @@ class Changeset < ActiveRecord::Base end referenced_issues += target_issues end + self.issues = referenced_issues.uniq end end |