diff options
author | mkanat%bugzilla.org <> | 2009-11-10 02:36:02 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-11-10 02:36:02 +0100 |
commit | 5d516a6ae2f021d2e276a842c24dff74d3448c45 (patch) | |
tree | d4aebc8e20cc8d207834d36b9663b87ecf593714 /template/en | |
parent | 88a69f2048d03b845e8e04fd23b1141df9fb8ee1 (diff) | |
download | bugzilla-5d516a6ae2f021d2e276a842c24dff74d3448c45.tar.gz bugzilla-5d516a6ae2f021d2e276a842c24dff74d3448c45.tar.xz |
Bug 472217: Create a Bugzilla::Comment object and eliminate GetComments
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'template/en')
-rw-r--r-- | template/en/default/bug/comments.html.tmpl | 20 | ||||
-rw-r--r-- | template/en/default/bug/edit.html.tmpl | 4 | ||||
-rw-r--r-- | template/en/default/bug/format_comment.txt.tmpl | 33 | ||||
-rw-r--r-- | template/en/default/bug/show-multiple.html.tmpl | 2 | ||||
-rw-r--r-- | template/en/default/bug/show.xml.tmpl | 12 | ||||
-rw-r--r-- | template/en/default/email/newchangedmail.txt.tmpl | 2 |
6 files changed, 33 insertions, 40 deletions
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 %] - <div class="bz_comment[% " bz_private" IF comment.isprivate %] + [% RETURN IF comment.is_private AND ! user.is_insider %] + + <div class="bz_comment[% " bz_private" IF comment.is_private %] [% " bz_comment_hilite" IF marks.$count %] [% " bz_first_comment" IF count == description %]"> [% IF count == description %] @@ -168,7 +168,7 @@ </span> [% END %] - [% IF mode == "edit" && isinsider %] + [% IF mode == "edit" && user.is_insider %] <div class="bz_private_checkbox"> <input type="hidden" value="1" name="defined_isprivate_[% comment.id %]"> @@ -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 %]> <label for="isprivate_[% comment.id %]">Private</label> </div> [% END %] @@ -201,7 +201,7 @@ </span> <span class="bz_comment_time"> - [%+ comment.time FILTER time %] + [%+ comment.creation_ts FILTER time %] </span> </div> @@ -215,15 +215,9 @@ [%# Don't indent the <pre> 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 %] <pre class="bz_comment_text" [% ' id="comment_text_' _ count _ '"' IF mode == "edit" %]> - [%- wrapped_comment FILTER quoteUrls(bug, comment) -%] + [%- comment.body_full({ wrap => 1 }) FILTER quoteUrls(bug, comment) -%] </pre> </div> - [% 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 @@ <form name="changeform" method="post" action="process_bug.cgi"> <input type="hidden" name="delta_ts" value="[% bug.delta_ts %]"> - <input type="hidden" name="longdesclength" value="[% bug.longdescs.size %]"> + <input type="hidden" name="longdesclength" value="[% bug.comments.size %]"> <input type="hidden" name="id" value="[% bug.bug_id %]"> <input type="hidden" name="token" value="[% issue_hash_token([bug.id, bug.delta_ts]) FILTER html %]"> @@ -287,7 +287,7 @@ <hr> <div id="comments"> [% PROCESS bug/comments.html.tmpl - comments = bug.longdescs + comments = bug.comments mode = user.id ? "edit" : "show" %] </div> 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 @@ <br> [% 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")) %] - <long_desc isprivate="[% c.isprivate FILTER xml %]"> + [% FOREACH c = bug.comments %] + [% NEXT IF c.is_private && !user.in_group(Param("insidergroup")) %] + <long_desc isprivate="[% c.is_private FILTER xml %]"> <commentid>[% c.id FILTER xml %]</commentid> <who name="[% c.author.name FILTER xml %]">[% c.author.email FILTER email FILTER xml %]</who> - <bug_when>[% c.time FILTER time("%Y-%m-%d %T %z") FILTER xml %]</bug_when> + <bug_when>[% c.creation_ts FILTER time("%Y-%m-%d %T %z") FILTER xml %]</bug_when> [% IF user.in_group(Param('timetrackinggroup')) && (c.work_time - 0 != 0) %] <work_time>[% PROCESS formattimeunit time_unit = c.work_time FILTER xml %]</work_time> [% END %] - <thetext>[% c.body FILTER xml %]</thetext> + <thetext>[% c.body_full FILTER xml %]</thetext> </long_desc> [% 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 %] |