diff options
author | Illya Marchenko <github-hek842t@social.mail.stuzer.link> | 2024-12-05 15:07:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-05 13:07:53 +0000 |
commit | 936665bf857787fb653a40dd202d0333c14e0e7e (patch) | |
tree | ba9a8676e18c95a9463239d0eb298c7cf05724d8 /services | |
parent | c5422fae9a41b870257b8cbe148ff8e661b190a0 (diff) | |
download | gitea-936665bf857787fb653a40dd202d0333c14e0e7e.tar.gz gitea-936665bf857787fb653a40dd202d0333c14e0e7e.zip |
Issue time estimate, meaningful time tracking (#23113)
Redesign the time tracker side bar, and add "time estimate" support (in "1d 2m" format)
Closes #23112
---------
Co-authored-by: stuzer05 <stuzer05@gmail.com>
Co-authored-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'services')
-rw-r--r-- | services/convert/issue_comment.go | 5 | ||||
-rw-r--r-- | services/forms/user_form_hidden_comments.go | 1 | ||||
-rw-r--r-- | services/issue/issue.go | 7 |
3 files changed, 13 insertions, 0 deletions
diff --git a/services/convert/issue_comment.go b/services/convert/issue_comment.go index 9ec9ac7684..b8527ae233 100644 --- a/services/convert/issue_comment.go +++ b/services/convert/issue_comment.go @@ -76,6 +76,11 @@ func ToTimelineComment(ctx context.Context, repo *repo_model.Repository, c *issu // so we check for the "|" delimiter and convert new to legacy format on demand c.Content = util.SecToTime(c.Content[1:]) } + + if c.Type == issues_model.CommentTypeChangeTimeEstimate { + timeSec, _ := util.ToInt64(c.Content) + c.Content = util.TimeEstimateString(timeSec) + } } comment := &api.TimelineComment{ diff --git a/services/forms/user_form_hidden_comments.go b/services/forms/user_form_hidden_comments.go index b9677c1800..76382ddfdd 100644 --- a/services/forms/user_form_hidden_comments.go +++ b/services/forms/user_form_hidden_comments.go @@ -43,6 +43,7 @@ var hiddenCommentTypeGroups = hiddenCommentTypeGroupsType{ /*14*/ issues_model.CommentTypeAddTimeManual, /*15*/ issues_model.CommentTypeCancelTracking, /*26*/ issues_model.CommentTypeDeleteTimeManual, + /*38*/ issues_model.CommentTypeChangeTimeEstimate, }, "deadline": { /*16*/ issues_model.CommentTypeAddedDeadline, diff --git a/services/issue/issue.go b/services/issue/issue.go index 72ea66c8d9..c6a52cc0fe 100644 --- a/services/issue/issue.go +++ b/services/issue/issue.go @@ -105,6 +105,13 @@ func ChangeTitle(ctx context.Context, issue *issues_model.Issue, doer *user_mode return nil } +// ChangeTimeEstimate changes the time estimate of this issue, as the given user. +func ChangeTimeEstimate(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, timeEstimate int64) (err error) { + issue.TimeEstimate = timeEstimate + + return issues_model.ChangeIssueTimeEstimate(ctx, issue, doer, timeEstimate) +} + // ChangeIssueRef changes the branch of this issue, as the given user. func ChangeIssueRef(ctx context.Context, issue *issues_model.Issue, doer *user_model.User, ref string) error { oldRef := issue.Ref |