From: Kohei Yoshino Date: Tue, 14 May 2019 19:48:36 +0000 (-0400) Subject: Bug 1521423 - Links to comments are not correct in bugmail X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38fe90c9a9db54d2922158f7a6b39c4899ac83c5;p=thirdparty%2Fbugzilla.git Bug 1521423 - Links to comments are not correct in bugmail --- diff --git a/Bugzilla/Markdown.pm b/Bugzilla/Markdown.pm index 6c7b06ecc..0c5287144 100644 --- a/Bugzilla/Markdown.pm +++ b/Bugzilla/Markdown.pm @@ -50,7 +50,7 @@ sub render_html { local $Bugzilla::Template::COLOR_QUOTES = 0; if ($markdown =~ /^\s*$MARKDOWN_OFF\n/s) { - my $text = $self->bugzilla_shorthand->( trim($markdown) ); + my $text = $self->bugzilla_shorthand->(trim($markdown), $bug); my $dom = Mojo::DOM->new($text); $dom->find('*')->each(sub { my ($e) = @_; @@ -88,7 +88,7 @@ sub render_html { && any { $child->parent->tag eq $_ } @valid_text_parent_tags) { my $text = $child->content; - $child->replace(Mojo::DOM->new($bugzilla_shorthand->($text))); + $child->replace(Mojo::DOM->new($bugzilla_shorthand->($text, $bug))); } return $child; }); diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index cde211b9d..355271b87 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -234,9 +234,6 @@ sub quoteUrls { ("\x{FDD2}" . ($count-1) . "\x{FDD3}") ~egmxi; - # Current bug ID this comment belongs to - my $current_bugurl = $bug ? ("show_bug.cgi?id=" . $bug->id) : ""; - # 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 @@ -248,7 +245,7 @@ sub quoteUrls { ~ # We have several choices. $1 here is the link, and $2-4 are set # depending on which part matched (defined($2) ? $bug_link_func->($2, $1, { comment_num => $3, user => $user }) : - "$1") + $bug ? $bug_link_func->($bug->id, $1, { comment_num => $4, user => $user }) : $1) ~egx; # Old duplicate markers. These don't use $bug_word because they are old