Commit 81ee29e7 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 524891: Make leading whitespace not be trimmed from comments on display.

Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
parent 608b923a
...@@ -3096,6 +3096,7 @@ sub format_comment { ...@@ -3096,6 +3096,7 @@ sub format_comment {
$template->process("bug/format_comment.txt.tmpl", $vars, \$body) $template->process("bug/format_comment.txt.tmpl", $vars, \$body)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
$body =~ s/^X//;
return $body; return $body;
} }
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
# Contributor(s): Marc Schumann <wurblzap@gmail.com> # Contributor(s): Marc Schumann <wurblzap@gmail.com>
#%] #%]
[%# NOTE: Everywhere you use this template, you must call
# "FILTER remove('^X')" on the result. This is unfortunately the only way
# to preserve leading whitespace in comments.
#%]
[%# INTERFACE: [%# INTERFACE:
# comment: A hash containing comment information. # comment: A hash containing comment information.
# count: The comment number (on the bug it belongs to) # count: The comment number (on the bug it belongs to)
...@@ -33,14 +38,8 @@ ...@@ -33,14 +38,8 @@
[% PROCESS 'global/field-descs.none.tmpl' %] [% PROCESS 'global/field-descs.none.tmpl' %]
[% IF comment.already_wrapped %] [% IF comment.type == constants.CMT_DUPE_OF %]
[% wrapped_comment = comment.body %] X[% comment.body %]
[% ELSE %]
[% wrapped_comment = comment.body FILTER wrap_comment %]
[% END %]
[%- IF comment.type == constants.CMT_DUPE_OF -%]
[% wrapped_comment %]
*** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ comment.extra_data %] *** *** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ comment.extra_data %] ***
[% ELSIF comment.type == constants.CMT_HAS_DUPE %] [% ELSIF comment.type == constants.CMT_HAS_DUPE %]
...@@ -48,7 +47,7 @@ ...@@ -48,7 +47,7 @@
[% ELSIF comment.type == constants.CMT_POPULAR_VOTES %] [% ELSIF comment.type == constants.CMT_POPULAR_VOTES %]
*** This [% terms.bug %] has been confirmed by popular vote. *** *** This [% terms.bug %] has been confirmed by popular vote. ***
[% ELSIF comment.type == constants.CMT_MOVED_TO %] [% ELSIF comment.type == constants.CMT_MOVED_TO %]
[% wrapped_comment %] X[% comment.body %]
[%+ terms.Bug %] moved to [% Param("move-to-url") %]. [%+ terms.Bug %] moved to [% Param("move-to-url") %].
If the move succeeded, [% comment.extra_data %] will receive a mail containing If the move succeeded, [% comment.extra_data %] will receive a mail containing
...@@ -56,6 +55,6 @@ the number of the new [% terms.bug %] in the other database. ...@@ -56,6 +55,6 @@ the number of the new [% terms.bug %] in the other database.
If all went well, please mark this [% terms.bug %] If all went well, please mark this [% terms.bug %]
[%+ display_value("bug_status", 'VERIFIED') %], and paste in a link to the new [% terms.bug %]. [%+ display_value("bug_status", 'VERIFIED') %], and paste in a link to the new [% terms.bug %].
Otherwise, reopen this [% terms.bug %]. Otherwise, reopen this [% terms.bug %].
[%- ELSE -%] [% ELSE %]
[%- wrapped_comment %] X[% comment.body %]
[% END %] [% END %]
...@@ -50,7 +50,7 @@ X-Bugzilla-Changed-Fields: [% changedfields %] ...@@ -50,7 +50,7 @@ X-Bugzilla-Changed-Fields: [% changedfields %]
[%- IF comment.count %] [%- IF comment.count %]
--- Comment #[% comment.count %] from [% comment.author.identity %] [%+ comment.time FILTER time %] --- --- Comment #[% comment.count %] from [% comment.author.identity %] [%+ comment.time FILTER time %] ---
[% END %] [% END %]
[%+ PROCESS bug/format_comment.txt.tmpl comment = comment %] [%+ FILTER remove('^X') %][% PROCESS bug/format_comment.txt.tmpl %][% END %]
[% END %] [% END %]
-- [%# Protect the trailing space of the signature marker %] -- [%# Protect the trailing space of the signature marker %]
......
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