diff options
Diffstat (limited to 'services/convert/issue_comment.go')
-rw-r--r-- | services/convert/issue_comment.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/services/convert/issue_comment.go b/services/convert/issue_comment.go index 2810c6c9bc..db48faa69e 100644 --- a/services/convert/issue_comment.go +++ b/services/convert/issue_comment.go @@ -11,6 +11,7 @@ import ( user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/log" api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/util" ) // ToComment converts a issues_model.Comment to the api.Comment format @@ -66,6 +67,17 @@ func ToTimelineComment(ctx context.Context, c *issues_model.Comment, doer *user_ return nil } + if c.Content != "" { + if (c.Type == issues_model.CommentTypeAddTimeManual || + c.Type == issues_model.CommentTypeStopTracking || + c.Type == issues_model.CommentTypeDeleteTimeManual) && + c.Content[0] == '|' { + // TimeTracking Comments from v1.21 on store the seconds instead of an formated string + // so we check for the "|" delimeter and convert new to legacy format on demand + c.Content = util.SecToTime(c.Content[1:]) + } + } + comment := &api.TimelineComment{ ID: c.ID, Type: c.Type.String(), |