]> source.dussan.org Git - redmine.git/commitdiff
Merged r3451 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 20 Feb 2010 10:22:06 +0000 (10:22 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 20 Feb 2010 10:22:06 +0000 (10:22 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3463 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
test/unit/helpers/application_helper_test.rb

index 0876127a14966d85d9536208d2ee47dadfe1a50b..a9751f33a2091195c200ba604e4906a4c9c9e88a 100644 (file)
@@ -506,17 +506,17 @@ module ApplicationHelper
     #  Forum messages:
     #     message#1218 -> Link to message with id 1218
     text = text.gsub(%r{([\s\(,\-\>]|^)(!)?(attachment|document|version|commit|source|export|message)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|<|$)}) do |m|
-      leading, esc, prefix, sep, oid = $1, $2, $3, $5 || $7, $6 || $8
+      leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8
       link = nil
       if esc.nil?
         if prefix.nil? && sep == 'r'
-          if project && (changeset = project.changesets.find_by_revision(oid))
-            link = link_to("r#{oid}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => oid},
+          if project && (changeset = project.changesets.find_by_revision(identifier))
+            link = link_to("r#{identifier}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision},
                                       :class => 'changeset',
                                       :title => truncate_single_line(changeset.comments, :length => 100))
           end
         elsif sep == '#'
-          oid = oid.to_i
+          oid = identifier.to_i
           case prefix
           when nil
             if issue = Issue.visible.find_by_id(oid, :include => :status)
@@ -547,7 +547,7 @@ module ApplicationHelper
           end
         elsif sep == ':'
           # removes the double quotes if any
-          name = oid.gsub(%r{^"(.*)"$}, "\\1")
+          name = identifier.gsub(%r{^"(.*)"$}, "\\1")
           case prefix
           when 'document'
             if project && document = project.documents.find_by_title(name)
@@ -584,7 +584,7 @@ module ApplicationHelper
           end
         end
       end
-      leading + (link || "#{prefix}#{sep}#{oid}")
+      leading + (link || "#{prefix}#{sep}#{identifier}")
     end
 
     text
index 2f7c6fdef95f7a759e02338c6841b22adbad6728..8e30192d78b0a889b56647f7f5c27d53ad3f2d01 100644 (file)
@@ -193,6 +193,8 @@ RAW
       '!version:1.0'                => 'version:1.0',
       '!version:"1.0"'              => 'version:"1.0"',
       '!source:/some/file'          => 'source:/some/file',
+      # not found
+      '#0123456789'                 => '#0123456789',
       # invalid expressions
       'source:'                     => 'source:',
       # url hash