mirror of https://github.com/go-gitea/gitea
Commit
This commit is contained in:
parent
a45c1e9c86
commit
db49783fa8
|
@ -990,7 +990,6 @@ type CreateCommentOptions struct {
|
|||
RefIsPull bool
|
||||
IsForcePush bool
|
||||
Invalidated bool
|
||||
TimeEstimate int64
|
||||
}
|
||||
|
||||
// GetCommentByID returns the comment by given ID.
|
||||
|
|
|
@ -212,11 +212,12 @@ func FinishIssueStopwatch(ctx context.Context, user *user_model.User, issue *Iss
|
|||
}
|
||||
|
||||
if _, err := CreateComment(ctx, &CreateCommentOptions{
|
||||
Doer: user,
|
||||
Issue: issue,
|
||||
Repo: issue.Repo,
|
||||
Type: CommentTypeStopTracking,
|
||||
TimeID: tt.ID,
|
||||
Doer: user,
|
||||
Issue: issue,
|
||||
Repo: issue.Repo,
|
||||
Content: util.SecToTime(timediff),
|
||||
Type: CommentTypeStopTracking,
|
||||
TimeID: tt.ID,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ func NewFuncMap() template.FuncMap {
|
|||
"DateTime": timeutil.DateTime,
|
||||
"Sec2Time": util.SecToTime,
|
||||
"SecToTimeExact": util.SecToTimeExact,
|
||||
"TimeEstimateToStr": timeutil.TimeEstimateToStr,
|
||||
"TimeEstimateToStr": util.TimeEstimateToStr,
|
||||
"LoadTimes": func(startTime time.Time) string {
|
||||
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
|
||||
},
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
package timeutil
|
||||
// Copyright 2022 Gitea. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
|
@ -2112,7 +2112,7 @@ func UpdateIssueTimeEstimate(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
total := timeutil.TimeEstimateFromStr(timeStr)
|
||||
total := util.TimeEstimateFromStr(timeStr)
|
||||
|
||||
// User entered something wrong
|
||||
if total == 0 && len(timeStr) != 0 {
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"code.gitea.io/gitea/models/db"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
@ -35,7 +34,7 @@ func AddTimeManually(c *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
total := timeutil.TimeEstimateFromStr(form.TimeString)
|
||||
total := util.TimeEstimateFromStr(form.TimeString)
|
||||
|
||||
if total <= 0 {
|
||||
c.Flash.Error(c.Tr("repo.issues.add_time_sum_to_small"))
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package issue
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"fmt"
|
||||
"html"
|
||||
"net/url"
|
||||
|
@ -20,11 +21,10 @@ import (
|
|||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/references"
|
||||
"code.gitea.io/gitea/modules/repository"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
)
|
||||
|
||||
func issueAddTime(issue *issues_model.Issue, doer *user_model.User, time time.Time, timeLog string) error {
|
||||
amount := timeutil.TimeEstimateFromStr(timeLog)
|
||||
amount := util.TimeEstimateFromStr(timeLog)
|
||||
if amount == 0 {
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue