]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 238207: Comment autolinkification on midair page points to wrong cgi - Patch...
authorlpsolit%gmail.com <>
Tue, 10 Jan 2006 03:02:51 +0000 (03:02 +0000)
committerlpsolit%gmail.com <>
Tue, 10 Jan 2006 03:02:51 +0000 (03:02 +0000)
Bugzilla/Template.pm
globals.pl
template/en/default/bug/comments.html.tmpl
template/en/default/bug/process/midair.html.tmpl

index abbe28aa99d504df964922ece3db3d95fdd91f5b..f4bcc7105cb71c94e3db1d3cfaac06a59e57e108 100644 (file)
@@ -309,7 +309,15 @@ sub create {
             # as prefix. In addition it replaces a ' ' by a '_'.
             css_class_quote => \&Bugzilla::Util::css_class_quote ,
 
-            quoteUrls => \&::quoteUrls ,
+            quoteUrls => [ sub {
+                               my ($context, $bug) = @_;
+                               return sub {
+                                   my $text = shift;
+                                   return &::quoteUrls($text, $bug);
+                               };
+                           },
+                           1
+                         ],
 
             bug_link => [ sub {
                               my ($context, $bug) = @_;
index 71d2bbe4706adb6f98d9bef22e64f8eca5c9e851..437667e0739187d783520e2b6f8483f3bdc728b1 100644 (file)
@@ -755,7 +755,7 @@ sub get_component_name {
 # If you want to modify this routine, read the comments carefully
 
 sub quoteUrls {
-    my ($text) = (@_);
+    my ($text, $curr_bugid) = (@_);
     return $text unless $text;
 
     # We use /g for speed, but uris can have other things inside them
@@ -817,6 +817,9 @@ sub quoteUrls {
                ("\0\0" . ($count-1) . "\0\0")
               ~egmxi;
 
+    # Current bug ID this comment belongs to
+    my $current_bugurl = $curr_bugid ? "show_bug.cgi?id=$curr_bugid" : "";
+    
     # This handles bug a, comment b type stuff. Because we're using /g
     # we have to do this in one pattern, and so this is semi-messy.
     # Also, we can't use $bug_re?$comment_re? because that will match the
@@ -827,7 +830,7 @@ sub quoteUrls {
               ~ # We have several choices. $1 here is the link, and $2-4 are set
                 # depending on which part matched
                (defined($2) ? GetBugLink($2,$1,$3) :
-                              "<a href=\"#c$4\">$1</a>")
+                              "<a href=\"$current_bugurl#c$4\">$1</a>")
               ~egox;
 
     # Duplicate markers
index f5f225246162df31beac2591d565b82d5ddf2050..c1ad0da7ff58ad34d45768ada8edb4502e9ee90a 100644 (file)
     [% wrapped_comment = comment.body FILTER wrap_comment %]
 [% END %]
 <pre[% ' id="comment_text_' _ count _ '"' IF mode == "edit" %]>
-  [%- wrapped_comment FILTER quoteUrls -%]
+  [%- wrapped_comment FILTER quoteUrls(bug.bug_id) -%]
 </pre>
     </div>
   [% END %]
index d5ae5fbf6299ea4dc5a3fe37fb3d617e5ea8a09d..01b9916dd1522674dc026e92a81117036dfc4a0f 100644 (file)
@@ -57,7 +57,7 @@
 <p>
   Added the comment(s):
   <blockquote>
-    [% PROCESS "bug/comments.html.tmpl" %]
+    [% PROCESS "bug/comments.html.tmpl" bug = { 'bug_id' => bug_id } %]
   </blockquote>
 </p>
 [% END %]