#12725 closed enhancement
Validate ticket comment changes — at Version 8
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.3.2 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
|
||
API Changes: | |||
Internal Changes: |
Description
Discussed in #12722.
_validate_ticket
should probably be called because currently max_comment_size
is not enforced for a comment edit: tags/trac-1.2/trac/ticket/web_ui.py#L1336. _validate_ticket
calls ITicketManipulator
, which would allow additional rules to be enforced for ticket comment changes.
ICommentManipulator
(comment:2:ticket:12722) might provide a nicer interface, but I'm unsure if it's necessary.
As suggested in #12642 for ticket workflow warnings, and similar to what is discussed in #11269, the warnings should be rendered near the comment edit box.
Change History (12)
comment:1 by , 7 years ago
follow-up: 7 comment:2 by , 7 years ago
Some plugins (th:TracHoursPlugin, th:PullRequestsPlugin) implement ITicketManipulator
mainly to manipulate / cause side-effects, not to validate. Will there still be a way for these plugins to avoid these side-effects on comment editing? (It looks like req.args.get('comment')
might return None
for comment editing, correct? That might conveniently keep them working as-is.)
comment:3 by , 7 years ago
Yes, req.args.get('comment')
returns None
for comment editing. I haven't checked, but it probably return an empty string for a ticket property change with no comment.
A plugin could also detect a comment edit by checking for 'edited_comment' in req.args
.
comment:4 by , 7 years ago
Milestone: | 1.2.1 → 1.3.2 |
---|
I'll target next-major-release since there is impact on plugins.
by , 7 years ago
Attachment: | Screen Shot 2017-03-15 at 11.52.41.png added |
---|
by , 7 years ago
Attachment: | Screen Shot 2017-03-15 at 11.52.17.png added |
---|
by , 7 years ago
Attachment: | Screen Shot 2017-03-15 at 11.55.49.png added |
---|
by , 7 years ago
Attachment: | Screen Shot 2017-03-15 at 12.00.49.png added |
---|
comment:5 by , 7 years ago
Part of #11269 will also be addressed in this ticket. I chose to place the warnings directly above the preview so that it doesn't interfere with the ticket property changes box. Here is an example of the interference:
With warnings placed above the preview:
For consistency I added a warning above the New Ticket preview:
For consistency I moved the edit conflict warnings and added a warning box for the Ticket Change preview:
comment:6 by , 7 years ago
Proposed changes in log:rjollos.git:t12725_validate_comment.1. I will add test coverage before committing.
comment:7 by , 7 years ago
Replying to Peter Suter:
Some plugins (th:TracHoursPlugin, th:PullRequestsPlugin) implement
ITicketManipulator
mainly to manipulate / cause side-effects, not to validate. Will there still be a way for these plugins to avoid these side-effects on comment editing? (It looks likereq.args.get('comment')
might returnNone
for comment editing, correct? That might conveniently keep them working as-is.)
Documented in TracDev/PluginDevelopment/ExtensionPoints/trac.ticket.api.ITicketManipulator@7.
comment:8 by , 7 years ago
Release Notes: | modified (diff) |
---|---|
Status: | assigned → closed |
Committed to trunk in r15719.
WIP changes in log:rjollos.git:t12725_validate_comment.