1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

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*
This commit is contained in:
6543
2023-06-23 14:12:39 +02:00
committed by GitHub
parent a954c93a68
commit b0215c40cd
6 changed files with 67 additions and 18 deletions

View File

@@ -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 {