mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-02 13:44:16 +09:00
Backport https://github.com/go-gitea/gitea/pull/39869 `PATCH /repos/{owner}/{repo}/milestones/{id}` always overwrote the due date with `due_on`, so a request that only changed other fields, such as `{"state": "closed"}`, silently removed it. The due date is now kept when `due_on` is omitted, and `"due_on": null` or `"due_on": ""` remove it. Only the milestone fix is backported. The issue and pull request deadline changes of https://github.com/go-gitea/gitea/pull/39869 build on https://github.com/go-gitea/gitea/pull/38677, which isn't on v28.
This commit is contained in:
1 parent
193c676946
commit
bc3e228e78
8 files changed
+97
-7
No files matched your search
@@ -41,6 +41,7 @@ func TestAPIIssuesMilestone(t *testing.T) {
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
apiMilestone := DecodeJSON(t, resp, &structs.Milestone{})
|
||||
assert.EqualValues(t, "closed", apiMilestone.State)
|
||||
assert.NotNil(t, apiMilestone.Deadline, "an omitted due_on keeps the due date")
|
||||
|
||||
req = NewRequest(t, "GET", urlStr).
|
||||
AddTokenAuth(token)
|
||||
@@ -48,6 +49,10 @@ func TestAPIIssuesMilestone(t *testing.T) {
|
||||
apiMilestone2 := DecodeJSON(t, resp, &structs.Milestone{})
|
||||
assert.EqualValues(t, "closed", apiMilestone2.State)
|
||||
|
||||
req = NewRequestWithJSON(t, "PATCH", urlStr, map[string]any{"due_on": ""}).AddTokenAuth(token)
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
assert.Nil(t, DecodeJSON(t, resp, &structs.Milestone{}).Deadline)
|
||||
|
||||
req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/milestones", owner.Name, repo.Name), structs.CreateMilestoneOption{
|
||||
Title: "wow",
|
||||
Description: "closed one",
|
||||
|
||||
Reference in new issue
Block a user