aboutsummaryrefslogtreecommitdiffstats
path: root/services
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 /services
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 'services')
-rw-r--r--services/convert/issue_comment.go12
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(),