#9227 closed defect (fixed)
In the ticket change history list, comment div's are printed even with empty comments.
Reported by: | Owned by: | Ryan J Ollos | |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.2 |
Component: | ticket system | Version: | 0.11-stable |
Severity: | trivial | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Ticket comment containing only whitespace, which includes zero-width spaces (ZWSP), will not be saved. |
||
API Changes: | |||
Internal Changes: |
Description
The ticket change history list contain following div-tag on each change event even with empty comment.
<div class="comment searchable"> </div>
It is an issue when using different background color or border for the comment fields.
I've fixed this issue like this in the trac/ticket/templates/ticket.html file
76c76
< <div py:if="'comment' in change" class="comment searchable" xml:space="preserve">
---
> <div py:if="change.comment" class="comment searchable" xml:space="preserve">
Attachments (0)
Change History (6)
comment:1 by , 14 years ago
Milestone: | → next-major-0.1X |
---|---|
Priority: | low → high |
Severity: | minor → trivial |
comment:2 by , 9 years ago
Keywords: | patch added |
---|
comment:3 by , 5 years ago
Component: | web frontend → ticket system |
---|---|
Keywords: | css xhtml patch removed |
Milestone: | next-major-releases → 1.4.2 |
Priority: | high → normal |
On 1.4-stable there is no empty div
tag if the comment is empty: tags/trac-1.4.1/trac/ticket/templates/ticket_change.html@:205-208#L192.
A comment consisting of only ZWSP is allowed. We should treat it the same as a comment containing only whitespace.
-
trac/ticket/model.py
diff --git a/trac/ticket/model.py b/trac/ticket/model.py index f4b3961e8..96ab13a7b 100644
a b from trac.ticket.api import TicketSystem 28 28 from trac.util import as_int, embedded_numbers, to_list 29 29 from trac.util.datefmt import (datetime_now, from_utimestamp, parse_date, 30 30 to_utimestamp, utc, utcmax) 31 from trac.util.text import empty 31 from trac.util.text import empty, stripws 32 32 from trac.util.translation import _, N_, gettext 33 33 34 34 __all__ = ['Ticket', 'Type', 'Status', 'Resolution', 'Priority', 'Severity', … … class Ticket(object): 349 349 350 350 props_unchanged = all(self.values.get(k) == v 351 351 for k, v in self._old.iteritems()) 352 if (not comment or not comment.strip()) and props_unchanged:352 if (not comment or not stripws(comment)) and props_unchanged: 353 353 return False # Not modified 354 354 355 355 if when is None:
comment:4 by , 5 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
Added test coverage: [d426df83a/rjollos.git].
comment:5 by , 5 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:6 by , 5 years ago
This change hasn't been deployed yet to t.e.o, but we had a comment on ticket #130 that is empty. I queried the database and it appears to be an empty string, no invisible chars such as ZWSP. There seems to still be a way to post an empty comment: branches/1.4-stable/trac/ticket/model.py@17347:350-353#L339.
… or even
change.get('comment')
.