From b0215c40cdf9a3e46a45a3823b894998d1044cda Mon Sep 17 00:00:00 2001 From: 6543 Date: Fri, 23 Jun 2023 14:12:39 +0200 Subject: Store and use seconds for timeline time comments (#25392) this will allow us to fully localize it later PS: we can not migrate back as the old value was a one-way conversion prepare for #25213 --- *Sponsored by Kithara Software GmbH* --- routers/web/repo/issue.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'routers/web') diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index a9ce1cc1e7..7d8ec3a6f3 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1647,9 +1647,22 @@ func ViewIssue(ctx *context.Context) { return } } else if comment.Type == issues_model.CommentTypeAddTimeManual || - comment.Type == issues_model.CommentTypeStopTracking { + comment.Type == issues_model.CommentTypeStopTracking || + comment.Type == issues_model.CommentTypeDeleteTimeManual { // drop error since times could be pruned from DB.. _ = comment.LoadTime() + if comment.Content != "" { + // Content before v1.21 did store the formated string instead of seconds, + // so "|" is used as delimeter to mark the new format + if comment.Content[0] != '|' { + // handle old time comments that have formatted text stored + comment.RenderedContent = comment.Content + comment.Content = "" + } else { + // else it's just a duration in seconds to pass on to the frontend + comment.Content = comment.Content[1:] + } + } } if comment.Type == issues_model.CommentTypeClose || comment.Type == issues_model.CommentTypeMergePull { -- cgit v1.2.3