diff options
Diffstat (limited to 'routers/api/v1')
-rw-r--r-- | routers/api/v1/repo/issue.go | 13 | ||||
-rw-r--r-- | routers/api/v1/repo/milestone.go | 7 | ||||
-rw-r--r-- | routers/api/v1/repo/pull.go | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index daaa3d5985..8595be335b 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -16,6 +16,7 @@ import ( issue_indexer "code.gitea.io/gitea/modules/indexer/issues" "code.gitea.io/gitea/modules/notification" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" api "code.gitea.io/gitea/modules/structs" @@ -183,9 +184,9 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) { // "201": // "$ref": "#/responses/Issue" - var deadlineUnix util.TimeStamp + var deadlineUnix timeutil.TimeStamp if form.Deadline != nil && ctx.Repo.CanWrite(models.UnitTypeIssues) { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) + deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) } issue := &models.Issue{ @@ -310,9 +311,9 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { } // Update the deadline - var deadlineUnix util.TimeStamp + var deadlineUnix timeutil.TimeStamp if form.Deadline != nil && !form.Deadline.IsZero() && ctx.Repo.CanWrite(models.UnitTypeIssues) { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) + deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) } if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { @@ -430,12 +431,12 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) { return } - var deadlineUnix util.TimeStamp + var deadlineUnix timeutil.TimeStamp var deadline time.Time if form.Deadline != nil && !form.Deadline.IsZero() { deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(), 23, 59, 59, 0, form.Deadline.Location()) - deadlineUnix = util.TimeStamp(deadline.Unix()) + deadlineUnix = timeutil.TimeStamp(deadline.Unix()) } if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go index 14030a2186..9bc73852ca 100644 --- a/routers/api/v1/repo/milestone.go +++ b/routers/api/v1/repo/milestone.go @@ -9,9 +9,8 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" - "code.gitea.io/gitea/modules/util" - api "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/timeutil" ) // ListMilestones list milestones for a repository @@ -127,7 +126,7 @@ func CreateMilestone(ctx *context.APIContext, form api.CreateMilestoneOption) { RepoID: ctx.Repo.Repository.ID, Name: form.Title, Content: form.Description, - DeadlineUnix: util.TimeStamp(form.Deadline.Unix()), + DeadlineUnix: timeutil.TimeStamp(form.Deadline.Unix()), } if err := models.NewMilestone(milestone); err != nil { @@ -187,7 +186,7 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) { milestone.Content = *form.Description } if form.Deadline != nil && !form.Deadline.IsZero() { - milestone.DeadlineUnix = util.TimeStamp(form.Deadline.Unix()) + milestone.DeadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) } if err := models.UpdateMilestone(milestone); err != nil { diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index d99c9a00c9..8168c6b010 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -17,7 +17,7 @@ import ( "code.gitea.io/gitea/modules/notification" "code.gitea.io/gitea/modules/pull" api "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/util" + "code.gitea.io/gitea/modules/timeutil" ) // ListPullRequests returns a list of all PRs @@ -247,9 +247,9 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption return } - var deadlineUnix util.TimeStamp + var deadlineUnix timeutil.TimeStamp if form.Deadline != nil { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) + deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) } maxIndex, err := models.GetMaxIndexOfIssue(repo.ID) @@ -375,9 +375,9 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) { } // Update Deadline - var deadlineUnix util.TimeStamp + var deadlineUnix timeutil.TimeStamp if form.Deadline != nil && !form.Deadline.IsZero() { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) + deadlineUnix = timeutil.TimeStamp(form.Deadline.Unix()) } if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { |