]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 499151: Only call format_comment when it's actually needed, as a slight
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Sat, 20 Feb 2010 19:52:25 +0000 (11:52 -0800)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Sat, 20 Feb 2010 19:52:25 +0000 (11:52 -0800)
performance improvement.
r=glob, a=LpSolit

Bugzilla/Comment.pm
template/en/default/bug/format_comment.txt.tmpl

index 60d26012f1df29e1db0a51911bc0d344e4efe10a..f19c64d78fe5d3dc049143eeaea5daf51c582143 100644 (file)
@@ -119,10 +119,15 @@ sub body_full {
     $params ||= {};
     my $template = Bugzilla->template_inner;
     my $body;
-    $template->process("bug/format_comment.txt.tmpl", 
-                       { comment => $self, %$params }, \$body)
-        || ThrowTemplateError($template->error());
-    $body =~ s/^X//;
+    if ($self->type) {
+        $template->process("bug/format_comment.txt.tmpl", 
+                           { comment => $self, %$params }, \$body)
+            || ThrowTemplateError($template->error());
+        $body =~ s/^X//;
+    }
+    else {
+        $body = $self->body;
+    }
     if ($params->{wrap} and !$self->already_wrapped) {
         $body = wrap_comment($body);
     }
index 2d4a20303d2f18179102ce04514530311b534675..7a65aed244be563c6c2f6f1a5cd90adef9d31442 100644 (file)
@@ -63,8 +63,6 @@ Comment on attachment [% comment.extra_data %]
 [%+ comment.attachment.description %]
 
 [%+ comment.body %]
-[% ELSIF comment.type %]
-  [% Hook.process('type') %]
 [% ELSE %]
-X[% comment_body %]
+X[% Hook.process('type') %]
 [% END %]