--- a/trac/tickets.go Tue Aug 04 22:11:15 2020 -0500
+++ b/trac/tickets.go Tue Aug 04 22:19:35 2020 -0500
@@ -156,6 +156,27 @@
return mapUser(username, unknownUser, users)
+ addComment := func(issue *youtrack.Issue, description string, comment *youtrack.Comment) { + // Add the description at the end to make sure all the field changes + // are always listed before it. + if comment.Text != "" { + comment.Text += description + // double check if there is no comment.text and if so dump in a + if comment.Text == "" { + comment.Text = "*no description*" + // our changes were loaded from the database ordered by timestamp, + // so if we hit a new time stamp, we're in a new change. + issue.Comments = append(issue.Comments, comment) issue := &youtrack.Issue{
@@ -197,20 +218,9 @@
for _, change := range t.Changes {
if comment != nil && convertTime(change.Time) != comment.Created {
- // Add the description at the end to make sure all the field changes
- // are always listed before it.
- if comment.Text != "" {
- comment.Text += description
- // our changes were loaded from the database ordered by timestamp,
- // so if we hit a new time stamp, we're in a new change.
- issue.Comments = append(issue.Comments, comment)
+ addComment(issue, description, comment) @@ -277,17 +287,10 @@
- // Add the description at the end to make sure all the field changes are
- // always listed before it.
- if comment.Text != "" {
- comment.Text += description
- issue.Comments = append(issue.Comments, comment)
+ addComment(issue, description, comment) // add all of the attachments