Edgewall Software
Modify

Opened 10 years ago

Closed 10 days ago

Last modified 7 days ago

#9227 closed defect (fixed)

In the ticket change history list, comment div's are printed even with empty comments.

Reported by: eino.saarela.rossi@… 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 Christian Boos, 10 years ago

Milestone: next-major-0.1X
Priority: lowhigh
Severity: minortrivial

… or even change.get('comment').

comment:2 by figaro, 4 years ago

Keywords: patch added

comment:3 by Ryan J Ollos, 11 days ago

Component: web frontendticket system
Keywords: css xhtml patch removed
Milestone: next-major-releases1.4.2
Priority: highnormal

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  
    2828from trac.util import as_int, embedded_numbers, to_list
    2929from trac.util.datefmt import (datetime_now, from_utimestamp, parse_date,
    3030                               to_utimestamp, utc, utcmax)
    31 from trac.util.text import empty
     31from trac.util.text import empty, stripws
    3232from trac.util.translation import _, N_, gettext
    3333
    3434__all__ = ['Ticket', 'Type', 'Status', 'Resolution', 'Priority', 'Severity',
    class Ticket(object):  
    349349
    350350        props_unchanged = all(self.values.get(k) == v
    351351                              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:
    353353            return False  # Not modified
    354354
    355355        if when is None:
Last edited 10 days ago by Ryan J Ollos (previous) (diff)

comment:4 by Ryan J Ollos, 11 days ago

Owner: set to Ryan J Ollos
Status: newassigned

Added test coverage: [d426df83a/rjollos.git].

comment:5 by Ryan J Ollos, 10 days ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.4-stable in r17347, merged to trunk in r17348.

comment:6 by Ryan J Ollos, 7 days 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.

Last edited 7 days ago by Ryan J Ollos (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.