aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
author6543 <m.huber@kithara.com>2023-06-23 14:12:39 +0200
committerGitHub <noreply@github.com>2023-06-23 12:12:39 +0000
commitb0215c40cdf9a3e46a45a3823b894998d1044cda (patch)
tree564ac8316c1cee99437879ba8594cbe786d04283 /routers/web
parenta954c93a68072042aa7dad717b6fa002c83a58fb (diff)
downloadgitea-b0215c40cdf9a3e46a45a3823b894998d1044cda.tar.gz
gitea-b0215c40cdf9a3e46a45a3823b894998d1044cda.zip
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*
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/issue.go15
1 files changed, 14 insertions, 1 deletions
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 {