]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1521423 - Links to comments are not correct in bugmail
authorKohei Yoshino <kohei.yoshino@gmail.com>
Tue, 14 May 2019 19:48:36 +0000 (15:48 -0400)
committerGitHub <noreply@github.com>
Tue, 14 May 2019 19:48:36 +0000 (15:48 -0400)
Bugzilla/Markdown.pm
Bugzilla/Template.pm

index 6c7b06ecc0ce1c50abbe3243f43532b559da7afc..0c528714407e3d312c86e7490bf6af1583c9c73a 100644 (file)
@@ -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;
     });
index cde211b9d0e4ea00df6b67e1383017b2e23d8dbe..355271b87ba18f3884a76499c2b69533381445bd 100644 (file)
@@ -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 }) :
-                              "<a href=\"$current_bugurl#c$4\">$1</a>")
+                $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