0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-16 15:01:07 +01:00

Use new OneDev /milestones endpoint (#17782)

OneDev changed the API which fails every build at the moment.
This commit is contained in:
KN4CK3R 2021-11-23 20:28:06 +01:00 committed by GitHub
parent 2dae5b715c
commit 429ef43793
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -284,7 +284,6 @@ func (d *OneDevDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, er
State string `json:"state"` State string `json:"state"`
Title string `json:"title"` Title string `json:"title"`
Description string `json:"description"` Description string `json:"description"`
MilestoneID int64 `json:"milestoneId"`
SubmitterID int64 `json:"submitterId"` SubmitterID int64 `json:"submitterId"`
SubmitDate time.Time `json:"submitDate"` SubmitDate time.Time `json:"submitDate"`
}, 0, perPage) }, 0, perPage)
@ -325,6 +324,23 @@ func (d *OneDevDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, er
} }
} }
milestones := make([]struct {
ID int64 `json:"id"`
Name string `json:"name"`
}, 0, 10)
err = d.callAPI(
fmt.Sprintf("/api/issues/%d/milestones", issue.ID),
nil,
&milestones,
)
if err != nil {
return nil, false, err
}
milestoneID := int64(0)
if len(milestones) > 0 {
milestoneID = milestones[0].ID
}
state := strings.ToLower(issue.State) state := strings.ToLower(issue.State)
if state == "released" { if state == "released" {
state = "closed" state = "closed"
@ -336,7 +352,7 @@ func (d *OneDevDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, er
PosterName: poster.Name, PosterName: poster.Name,
PosterEmail: poster.Email, PosterEmail: poster.Email,
Content: issue.Description, Content: issue.Description,
Milestone: d.milestoneMap[issue.MilestoneID], Milestone: d.milestoneMap[milestoneID],
State: state, State: state,
Created: issue.SubmitDate, Created: issue.SubmitDate,
Updated: issue.SubmitDate, Updated: issue.SubmitDate,