#12843 closed enhancement (fixed)
Quote cloned ticket description
Reported by: | anonymous | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.3.2 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | bitesized ticketclone |
Cc: | Branch: | ||
Release Notes: |
The cloned ticket description is quoted when cloning a ticket. |
||
API Changes: | |||
Internal Changes: |
Description
Cloning a ticket or ticket comment adds this to the description:
Copied from [ticket:123#comment:456]: ---- Unquoted description or comment
Replying instead adds this:
Replying to [comment:456 User Name]: > Quoted description or comment
That seems much more helpful.
The cloning functionality be changed to add something like this:
Copied from comment:456:ticket:123 by User Name: > Quoted description or comment
Attachments (0)
Change History (9)
comment:1 by , 8 years ago
Keywords: | bitesized ticketclone added |
---|
comment:2 by , 7 years ago
Milestone: | → 1.3.2 |
---|---|
Owner: | set to |
Status: | new → assigned |
follow-up: 7 comment:3 by , 7 years ago
Proposed changes for #12842 and #12843 in log:rjollos.git:t12843_ticket_clone_improvements.
I split on \r?\n
because splitlines does the same: trunk/trac/ticket/web_ui.py@15943:1646#L1638.
comment:4 by , 7 years ago
Very nice! But please also change same thing in addCloneFromComments.
While you are at it, can you remove the (ugly and (annoying) unbalanced parentheses around the summary on line 83? Thank you!
comment:6 by , 7 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Committed to trunk in r16106.
comment:7 by , 7 years ago
Replying to Ryan J Ollos:
Proposed changes for #12842 and #12843 in log:rjollos.git:t12843_ticket_clone_improvements.
I split on
\r?\n
because splitlines does the same: trunk/trac/ticket/web_ui.py@15943:1646#L1638.
I think we should see unicode.splitlines rather than str.splitlines.
Also, \r
is one of line boundaries in str.splitlines()
but /\r?\n/
doesn't match \r
.
>>> 'aaaa\rbbbb\nccccc\r\ndddd'.splitlines() ['aaaa', 'bbbb', 'ccccc', 'dddd']
comment:8 by , 7 years ago
Trivial thing: unnecessary extra \n>
would be appended if description and comment are ended with newline.
> "Line 1\r\nLine 2\r\nLine 3\r\n".split(/\r?\n/).join('\n> ') 'Line 1\n> Line 2\n> Line 3\n> ' ^^^^
-
tracopt/ticket/htdocs/ticketclone.coffee
69 69 _("(part of #%(ticketid)s) %(summary)s", 70 70 ticketid: old_values.id, summary: old_values.summary) 71 71 addField cform, 'description', 72 _("Copied from [%(source)s]:\n >%(description)s",72 _("Copied from [%(source)s]:\n%(description)s", 73 73 source: "ticket:#{old_values.id}#comment:#{c.cnum}", 74 description: c.comment.split(/\r?\n/).join('\n> '))74 description: quoteText(c.comment)) 75 75 76 76 btns.prepend cform 77 77 … … 82 82 addField clone, 'summary', 83 83 _("%(summary)s (cloned)", summary: old_values.summary) 84 84 addField clone, 'description', 85 _("Cloned from #%(id)s:\n > %(description)s\n",85 _("Cloned from #%(id)s:\n%(description)s", 86 86 id: old_values.id, 87 description: old_values.description.split(/\r?\n/).join('\n> '))87 description: quoteText(old_values.description)) 88 88 $('#ticket .description .searchable').before(clone) 89 89 # clone from comment 90 90 if old_values? and changes? 91 91 addCloneFromComments (c for c in changes when c.cnum? and 92 92 c.comment and c.permanent) 93 94 95 quoteText = (text) -> 96 if text 97 length = text.length 98 pattern = /\r\n|[\r\n\u000b\u000c\u001c\u001d\u001e\u0085\u2028\u2029]/g 99 repl = (match, offset) -> 100 if match.length + offset != length then '\n> ' else '' 101 '> ' + text.replace(pattern, repl) + '\n' 102 else 103 return ''
PatchWelcome.