summaryrefslogtreecommitdiffstats
path: root/app/models/changeset.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/changeset.rb')
-rw-r--r--app/models/changeset.rb9
1 files changed, 9 insertions, 0 deletions
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