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
tokarchuk/v1.17
Rodrigo Villablanca Vásquez 6 years ago committed by Jonas Franz
parent 63bd1b9203
commit 4c52858c39
  1. 14
      routers/api/v1/repo/issue.go
  2. 2
      routers/repo/milestone.go
  3. 6
      templates/swagger/v1_json.tmpl

@ -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})
}

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

@ -1967,7 +1967,7 @@
"tags": [
"issue"
],
"summary": "Create an issue",
"summary": "Create an issue. If using deadline only the date will be taken into account, and time of day ignored.",
"operationId": "issueCreateIssue",
"parameters": [
{
@ -2271,7 +2271,7 @@
"tags": [
"issue"
],
"summary": "Edit an issue",
"summary": "Edit an issue. If using deadline only the date will be taken into account, and time of day ignored.",
"operationId": "issueEditIssue",
"parameters": [
{
@ -2521,7 +2521,7 @@
"tags": [
"issue"
],
"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.",
"operationId": "issueEditIssueDeadline",
"parameters": [
{

Loading…
Cancel
Save