From 5d516a6ae2f021d2e276a842c24dff74d3448c45 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 10 Nov 2009 01:36:02 +0000 Subject: Bug 472217: Create a Bugzilla::Comment object and eliminate GetComments Patch by Max Kanat-Alexander r=LpSolit, a=LpSolit --- template/en/default/bug/comments.html.tmpl | 20 +++++--------- template/en/default/bug/edit.html.tmpl | 4 +-- template/en/default/bug/format_comment.txt.tmpl | 33 +++++++++++------------ template/en/default/bug/show-multiple.html.tmpl | 2 +- template/en/default/bug/show.xml.tmpl | 12 ++++----- template/en/default/email/newchangedmail.txt.tmpl | 2 +- 6 files changed, 33 insertions(+), 40 deletions(-) (limited to 'template/en') diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index 2f9eeebf6..41436f9b2 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -94,7 +94,6 @@ [% DEFAULT start_at = 0 mode = "show" %] -[% isinsider = Param("insidergroup") && user.in_group(Param("insidergroup")) %] [% sort_order = user.settings.comment_sort_order.value %] [%# NOTE: (start_at > 0) means we came here from a midair collision, @@ -145,8 +144,9 @@ [%############################################################################%] [% BLOCK a_comment %] - [% IF NOT comment.isprivate || isinsider %] -
[% IF count == description %] @@ -168,7 +168,7 @@ [% END %] - [% IF mode == "edit" && isinsider %] + [% IF mode == "edit" && user.is_insider %]
@@ -176,7 +176,7 @@ name="isprivate_[% comment.id %]" value="1" id="isprivate_[% comment.id %]" onClick="updateCommentPrivacy(this, [% count %])" - [% " checked=\"checked\"" IF comment.isprivate %]> + [% " checked=\"checked\"" IF comment.is_private %]>
[% END %] @@ -201,7 +201,7 @@ - [%+ comment.time FILTER time %] + [%+ comment.creation_ts FILTER time %]
@@ -215,15 +215,9 @@ [%# Don't indent the
 block, since then the spaces are displayed in the
   # generated HTML
   #%]
-[% IF comment.already_wrapped %]
-    [% wrapped_comment = comment.body %]
-[% ELSE %]
-    [% wrapped_comment = comment.body FILTER wrap_comment %]
-[% END %]
 
-  [%- wrapped_comment FILTER quoteUrls(bug, comment) -%]
+  [%- comment.body_full({ wrap => 1 }) FILTER quoteUrls(bug, comment) -%]
 
- [% END %] [% END %] diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index d5a345182..006603f59 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -142,7 +142,7 @@
- + @@ -287,7 +287,7 @@
[% PROCESS bug/comments.html.tmpl - comments = bug.longdescs + comments = bug.comments mode = user.id ? "edit" : "show" %]
diff --git a/template/en/default/bug/format_comment.txt.tmpl b/template/en/default/bug/format_comment.txt.tmpl index e0881e4e7..8e97d4d08 100644 --- a/template/en/default/bug/format_comment.txt.tmpl +++ b/template/en/default/bug/format_comment.txt.tmpl @@ -23,23 +23,23 @@ #%] [%# INTERFACE: - # comment: A hash containing comment information. - # count: The comment number (on the bug it belongs to) - # author: The Bugzilla::User object of the comment's - # author - # time: The time at which the comment has been - # committed - # body: The comment text - # type: One of the CMT_* constants (not given if none - # applies) - # extra_data: Extra data (type specific) - # already_wrapped: Determines whether the comment is pre-wrapped + # comment: A Bugzilla::Comment object. + # is_bugmail: boolean; True if this comment is going into a plain-text + # bugmail. #%] -[% PROCESS 'global/field-descs.none.tmpl' %] +[%# Please don't use field-descs here. It can slow down Bugzilla. %] +[% PROCESS 'global/variables.none.tmpl' %] + +[% SET comment_body = comment.body %] +[% IF is_bugmail %] + [% comment_body = comment_body.replace( '(Created an attachment \(id=([0-9]+)\))', + '$1' _ "\n" _ ' --> (' _ urlbase + _ 'attachment.cgi?id=$2)' ) %] +[% END %] [% IF comment.type == constants.CMT_DUPE_OF %] -X[% comment.body %] +X[% comment_body %] *** This [% terms.bug %] has been marked as a duplicate of [% terms.bug %] [%+ comment.extra_data %] *** [% ELSIF comment.type == constants.CMT_HAS_DUPE %] @@ -47,14 +47,13 @@ X[% comment.body %] [% ELSIF comment.type == constants.CMT_POPULAR_VOTES %] *** This [% terms.bug %] has been confirmed by popular vote. *** [% ELSIF comment.type == constants.CMT_MOVED_TO %] -X[% comment.body %] +X[% comment_body %] [%+ terms.Bug %] moved to [% Param("move-to-url") %]. If the move succeeded, [% comment.extra_data %] will receive a mail containing the number of the new [% terms.bug %] in the other database. -If all went well, please mark this [% terms.bug %] -[%+ display_value("bug_status", 'VERIFIED') %], and paste in a link to the new [% terms.bug %]. +If all went well, please paste in a link to the new [% terms.bug %]. Otherwise, reopen this [% terms.bug %]. [% ELSE %] -X[% comment.body %] +X[% comment_body %] [% END %] diff --git a/template/en/default/bug/show-multiple.html.tmpl b/template/en/default/bug/show-multiple.html.tmpl index 473453eb5..903d9d622 100644 --- a/template/en/default/bug/show-multiple.html.tmpl +++ b/template/en/default/bug/show-multiple.html.tmpl @@ -289,7 +289,7 @@
[% PROCESS bug/comments.html.tmpl - comments = bug.longdescs %] + comments = bug.comments %] [% END %] diff --git a/template/en/default/bug/show.xml.tmpl b/template/en/default/bug/show.xml.tmpl index 1db320c4f..42464aa14 100644 --- a/template/en/default/bug/show.xml.tmpl +++ b/template/en/default/bug/show.xml.tmpl @@ -65,16 +65,16 @@ [% PROCESS section_flags obj => bug %] [% IF displayfields.long_desc %] - [% FOREACH c = bug.longdescs %] - [% NEXT IF c.isprivate && !user.in_group(Param("insidergroup")) %] - + [% FOREACH c = bug.comments %] + [% NEXT IF c.is_private && !user.in_group(Param("insidergroup")) %] + [% c.id FILTER xml %] [% c.author.email FILTER email FILTER xml %] - [% c.time FILTER time("%Y-%m-%d %T %z") FILTER xml %] + [% c.creation_ts FILTER time("%Y-%m-%d %T %z") FILTER xml %] [% IF user.in_group(Param('timetrackinggroup')) && (c.work_time - 0 != 0) %] [% PROCESS formattimeunit time_unit = c.work_time FILTER xml %] [% END %] - [% c.body FILTER xml %] + [% c.body_full FILTER xml %] [% END %] [% END %] @@ -151,4 +151,4 @@ [% END %] /> [% END %] -[% END %] \ No newline at end of file +[% END %] diff --git a/template/en/default/email/newchangedmail.txt.tmpl b/template/en/default/email/newchangedmail.txt.tmpl index 9b1443bc2..368c23713 100644 --- a/template/en/default/email/newchangedmail.txt.tmpl +++ b/template/en/default/email/newchangedmail.txt.tmpl @@ -50,7 +50,7 @@ X-Bugzilla-Changed-Fields: [% changedfields %] [%- IF comment.count %] --- Comment #[% comment.count %] from [% comment.author.identity %] [%+ comment.time FILTER time %] --- [% END %] -[%+ FILTER remove('^X') %][% PROCESS bug/format_comment.txt.tmpl %][% END %] +[%+ comment.body_full({ is_bugmail => 1, wrap => 1 }) %] [% END %] -- [%# Protect the trailing space of the signature marker %] -- cgit v1.2.3-24-g4f1b