diff options
author | Rodrigo Villablanca Vásquez <villa061004@gmail.com> | 2019-01-01 14:56:47 -0300 |
---|---|---|
committer | Jonas Franz <info@jonasfranz.software> | 2019-01-01 18:56:47 +0100 |
commit | 4c52858c39f848198a61b27a9a8fe70d12db3b44 (patch) | |
tree | 2f2987f9cdb43e2f6e6eed974647047f9c18f987 /routers | |
parent | 63bd1b92037c5deb1bb13b0753855a689b9450bc (diff) | |
download | gitea-4c52858c39f848198a61b27a9a8fe70d12db3b44.tar.gz gitea-4c52858c39f848198a61b27a9a8fe70d12db3b44.zip |
Issue is not overdue when it is on the same date #5566 (#5568)
* Due date time of issues and milestones is set to 23:59:59
* Add docs
* make gen swagger
* fix swagger gen
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/issue.go | 14 | ||||
-rw-r--r-- | routers/repo/milestone.go | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index 65c97888f5..fe00715949 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -9,6 +9,7 @@ import ( "fmt" "net/http" "strings" + "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" @@ -144,7 +145,7 @@ func GetIssue(ctx *context.APIContext) { func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) { // swagger:operation POST /repos/{owner}/{repo}/issues issue issueCreateIssue // --- - // summary: Create an issue + // summary: Create an issue. If using deadline only the date will be taken into account, and time of day ignored. // consumes: // - application/json // produces: @@ -236,7 +237,7 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) { func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { // swagger:operation PATCH /repos/{owner}/{repo}/issues/{index} issue issueEditIssue // --- - // summary: Edit an issue + // summary: Edit an issue. If using deadline only the date will be taken into account, and time of day ignored. // consumes: // - application/json // produces: @@ -360,7 +361,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) { func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) { // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/deadline issue issueEditIssueDeadline // --- - // summary: Set an issue deadline. If set to null, the deadline is deleted. + // summary: Set an issue deadline. If set to null, the deadline is deleted. If using deadline only the date will be taken into account, and time of day ignored. // consumes: // - application/json // produces: @@ -410,8 +411,11 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) { } var deadlineUnix util.TimeStamp + var deadline time.Time if form.Deadline != nil && !form.Deadline.IsZero() { - deadlineUnix = util.TimeStamp(form.Deadline.Unix()) + deadline = time.Date(form.Deadline.Year(), form.Deadline.Month(), form.Deadline.Day(), + 23, 59, 59, 0, form.Deadline.Location()) + deadlineUnix = util.TimeStamp(deadline.Unix()) } if err := models.UpdateIssueDeadline(issue, deadlineUnix, ctx.User); err != nil { @@ -419,5 +423,5 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) { return } - ctx.JSON(201, api.IssueDeadline{Deadline: form.Deadline}) + ctx.JSON(201, api.IssueDeadline{Deadline: &deadline}) } diff --git a/routers/repo/milestone.go b/routers/repo/milestone.go index eb2141e995..6c3ad11f1f 100644 --- a/routers/repo/milestone.go +++ b/routers/repo/milestone.go @@ -113,6 +113,7 @@ func NewMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) { return } + deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, deadline.Location()) if err = models.NewMilestone(&models.Milestone{ RepoID: ctx.Repo.Repository.ID, Name: form.Title, @@ -175,6 +176,7 @@ func EditMilestonePost(ctx *context.Context, form auth.CreateMilestoneForm) { return } + deadline = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 23, 59, 59, 0, deadline.Location()) m, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) if err != nil { if models.IsErrMilestoneNotExist(err) { |