summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2014-07-03 15:36:08 +0800
committerByron Jones <glob@mozilla.com>2014-07-03 15:36:08 +0800
commit99e02eab80679cb1ac4ede7c4d8054b8a2164bad (patch)
tree6b406d68f5f9c0a260f44366b9ecf4d2b2604586 /Bugzilla/Template.pm
parentBug 1031274 - Cannot update multiple bugs at once if you don't change a integ... (diff)
downloadbugzilla-99e02eab80679cb1ac4ede7c4d8054b8a2164bad.tar.gz
bugzilla-99e02eab80679cb1ac4ede7c4d8054b8a2164bad.tar.bz2
bugzilla-99e02eab80679cb1ac4ede7c4d8054b8a2164bad.zip
Bug 1028795: pre-load all related bugs during show_bug initialisation
r=sgreen,a=sgreen
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index d1457a4fa..8fe50fa4f 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -147,9 +147,10 @@ sub get_format {
# If you want to modify this routine, read the comments carefully
sub quoteUrls {
- my ($text, $bug, $comment, $user) = @_;
+ my ($text, $bug, $comment, $user, $bug_link_func) = @_;
return $text unless $text;
$user ||= Bugzilla->user;
+ $bug_link_func ||= \&get_bug_link;
# We use /g for speed, but uris can have other things inside them
# (http://foo/bug#3 for example). Filtering that out filters valid
@@ -203,7 +204,7 @@ sub quoteUrls {
map { qr/$_/ } grep($_, Bugzilla->params->{'urlbase'},
Bugzilla->params->{'sslbase'})) . ')';
$text =~ s~\b(${urlbase_re}\Qshow_bug.cgi?id=\E([0-9]+)(\#c([0-9]+))?)\b
- ~($things[$count++] = get_bug_link($3, $1, { comment_num => $5, user => $user })) &&
+ ~($things[$count++] = $bug_link_func->($3, $1, { comment_num => $5, user => $user })) &&
("\x{FDD2}" . ($count-1) . "\x{FDD3}")
~egox;
@@ -250,7 +251,7 @@ sub quoteUrls {
$text =~ s~\b($bug_re(?:$s*,?$s*$comment_re)?|$comment_re)
~ # We have several choices. $1 here is the link, and $2-4 are set
# depending on which part matched
- (defined($2) ? get_bug_link($2, $1, { comment_num => $3, user => $user }) :
+ (defined($2) ? $bug_link_func->($2, $1, { comment_num => $3, user => $user }) :
"<a href=\"$current_bugurl#c$4\">$1</a>")
~egx;
@@ -266,7 +267,7 @@ sub quoteUrls {
my $length = $+[0] - $-[0];
my $match = $1;
- $match =~ s/((?:#$s*)?(\d+))/get_bug_link($2, $1);/eg;
+ $match =~ s/((?:#$s*)?(\d+))/$bug_link_func->($2, $1);/eg;
# Replace the old string with the linkified one.
substr($text, $offset, $length) = $match;
}
@@ -289,7 +290,7 @@ sub quoteUrls {
$text =~ s~(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ )
(\d+)
(?=\ \*\*\*\Z)
- ~get_bug_link($1, $1, { user => $user })
+ ~$bug_link_func->($1, $1, { user => $user })
~egmx;
# Now remove the encoding hacks in reverse order