summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoosha Khajeh Moogahi <koosha.khajeh@gmail.com>2012-10-13 17:27:15 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-10-13 17:27:15 +0200
commitaade844e708848c0b3efc7c7cb1ad49fc7728318 (patch)
treea428c92ccb13894615a14e6aca5d8a8a23e3e575
parent464ffc8c04f315b2f2aaa8e5620f1fe65a719121 (diff)
downloadbugzilla-aade844e708848c0b3efc7c7cb1ad49fc7728318.tar.gz
bugzilla-aade844e708848c0b3efc7c7cb1ad49fc7728318.tar.xz
Bug 213440: quoteUrls() should permit multiple bug numbers to be linkified in comments
r/a=LpSolit
-rw-r--r--Bugzilla/Template.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index f6796dfc7..d00799900 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -244,6 +244,23 @@ sub quoteUrls {
"<a href=\"$current_bugurl#c$4\">$1</a>")
~egox;
+ # Handle a list of bug ids: bugs 1, #2, 3, 4
+ # Currently, the only delimiter supported is comma.
+ # Concluding "and" and "or" are not supported.
+ my $bugs_word = template_var('terms')->{bugs};
+
+ my $bugs_re = qr/\Q$bugs_word\E\s*\#?\s*
+ \d+(?:\s*,\s*\#?\s*\d+)+/ix;
+ while ($text =~ m/($bugs_re)/go) {
+ my $offset = $-[0];
+ my $length = $+[0] - $-[0];
+ my $match = $1;
+
+ $match =~ s/((?:#\s*)?(\d+))/get_bug_link($2, $1);/eg;
+ # Replace the old string with the linkified one.
+ substr($text, $offset, $length) = $match;
+ }
+
# Old duplicate markers. These don't use $bug_word because they are old
# and were never customizable.
$text =~ s~(?<=^\*\*\*\ This\ bug\ has\ been\ marked\ as\ a\ duplicate\ of\ )