]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1518303 - Comments on splinter patches are misformatted with markdown styling
authorDylan William Hardison <dylan@hardison.net>
Tue, 8 Jan 2019 15:07:39 +0000 (10:07 -0500)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 15:07:39 +0000 (10:07 -0500)
Bugzilla/Comment.pm
extensions/Splinter/Extension.pm

index 5604175aed54038df3c33eb82ca8d4c0b720239d..f5dcc56c25a04ff2274f54f5bab70369b1bb1be9 100644 (file)
@@ -52,6 +52,7 @@ use constant UPDATE_COLUMNS => qw(
   isprivate
   type
   extra_data
+  is_markdown
 );
 
 use constant DB_TABLE => 'longdescs';
@@ -344,6 +345,7 @@ sub body_full {
 sub set_is_private { $_[0]->set('isprivate',  $_[1]); }
 sub set_type       { $_[0]->set('type',       $_[1]); }
 sub set_extra_data { $_[0]->set('extra_data', $_[1]); }
+sub set_is_markdown { $_[0]->set('is_markdown', $_[1]); }
 
 sub add_tag {
   my ($self, $tag) = @_;
index 86e92933b95b3d745727a9794d386bb1ac34659a..f5a2248a0cd38c378265b33a777ff1eeb11da34a 100644 (file)
@@ -108,6 +108,18 @@ sub page_before_template {
   }
 }
 
+sub object_end_of_create {
+  my ($self, $args) = @_;
+  my $class = $args->{class};
+
+  if ($class eq 'Bugzilla::Comment') {
+    my $comment = $args->{object};
+    if ($comment->body =~ /^Review of attachment (\d+)\s*:\n-{65}\n\n/s) {
+      $comment->set_is_markdown(0);
+      $comment->update;
+    }
+  }
+}
 
 sub bug_format_comment {
   my ($self, $args) = @_;