Commit abeb2964 authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

Bug 499151: Only call format_comment when it's actually needed, as a slight

performance improvement. r=glob, a=LpSolit
parent 09df4b6f
...@@ -119,10 +119,15 @@ sub body_full { ...@@ -119,10 +119,15 @@ sub body_full {
$params ||= {}; $params ||= {};
my $template = Bugzilla->template_inner; my $template = Bugzilla->template_inner;
my $body; my $body;
$template->process("bug/format_comment.txt.tmpl", if ($self->type) {
{ comment => $self, %$params }, \$body) $template->process("bug/format_comment.txt.tmpl",
|| ThrowTemplateError($template->error()); { comment => $self, %$params }, \$body)
$body =~ s/^X//; || ThrowTemplateError($template->error());
$body =~ s/^X//;
}
else {
$body = $self->body;
}
if ($params->{wrap} and !$self->already_wrapped) { if ($params->{wrap} and !$self->already_wrapped) {
$body = wrap_comment($body); $body = wrap_comment($body);
} }
......
...@@ -63,8 +63,6 @@ Comment on attachment [% comment.extra_data %] ...@@ -63,8 +63,6 @@ Comment on attachment [% comment.extra_data %]
[%+ comment.attachment.description %] [%+ comment.attachment.description %]
[%+ comment.body %] [%+ comment.body %]
[% ELSIF comment.type %]
[% Hook.process('type') %]
[% ELSE %] [% ELSE %]
X[% comment_body %] X[% Hook.process('type') %]
[% END %] [% END %]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment