From: lpsolit%gmail.com <> Date: Tue, 10 Jan 2006 03:02:51 +0000 (+0000) Subject: Bug 238207: Comment autolinkification on midair page points to wrong cgi - Patch... X-Git-Tag: bugzilla-2.20.1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31f1c1ee0f9aab4ad5397a346bf5fb800e9d0ab0;p=thirdparty%2Fbugzilla.git Bug 238207: Comment autolinkification on midair page points to wrong cgi - Patch by Olav Vitters r=LpSolit a=justdave --- diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index abbe28aa99..f4bcc7105c 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -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) = @_; diff --git a/globals.pl b/globals.pl index 71d2bbe470..437667e073 100644 --- a/globals.pl +++ b/globals.pl @@ -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) : - "$1") + "$1") ~egox; # Duplicate markers diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index f5f2252461..c1ad0da7ff 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -132,7 +132,7 @@ [% wrapped_comment = comment.body FILTER wrap_comment %] [% END %] - [%- wrapped_comment FILTER quoteUrls -%] + [%- wrapped_comment FILTER quoteUrls(bug.bug_id) -%] [% END %] diff --git a/template/en/default/bug/process/midair.html.tmpl b/template/en/default/bug/process/midair.html.tmpl index d5ae5fbf62..01b9916dd1 100644 --- a/template/en/default/bug/process/midair.html.tmpl +++ b/template/en/default/bug/process/midair.html.tmpl @@ -57,7 +57,7 @@

Added the comment(s):

- [% PROCESS "bug/comments.html.tmpl" %] + [% PROCESS "bug/comments.html.tmpl" bug = { 'bug_id' => bug_id } %]

[% END %]