aboutsummaryrefslogtreecommitdiffstats
path: root/services/migrations
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-11-23 20:28:06 +0100
committerGitHub <noreply@github.com>2021-11-23 20:28:06 +0100
commit429ef43793dee22ef3e610909b661b807a1bb165 (patch)
treed0b9c96e5fab02cd025a40320a336310d13777cb /services/migrations
parent2dae5b715c8c7eb6510af9915ca866e6d02e6d80 (diff)
downloadgitea-429ef43793dee22ef3e610909b661b807a1bb165.tar.gz
gitea-429ef43793dee22ef3e610909b661b807a1bb165.zip
Use new OneDev /milestones endpoint (#17782)
OneDev changed the API which fails every build at the moment.
Diffstat (limited to 'services/migrations')
-rw-r--r--services/migrations/onedev.go20
1 files changed, 18 insertions, 2 deletions
diff --git a/services/migrations/onedev.go b/services/migrations/onedev.go
index 1159026892..5d5aaa40f9 100644
--- a/services/migrations/onedev.go
+++ b/services/migrations/onedev.go
@@ -284,7 +284,6 @@ func (d *OneDevDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, er
State string `json:"state"`
Title string `json:"title"`
Description string `json:"description"`
- MilestoneID int64 `json:"milestoneId"`
SubmitterID int64 `json:"submitterId"`
SubmitDate time.Time `json:"submitDate"`
}, 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)
if state == "released" {
state = "closed"
@@ -336,7 +352,7 @@ func (d *OneDevDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, er
PosterName: poster.Name,
PosterEmail: poster.Email,
Content: issue.Description,
- Milestone: d.milestoneMap[issue.MilestoneID],
+ Milestone: d.milestoneMap[milestoneID],
State: state,
Created: issue.SubmitDate,
Updated: issue.SubmitDate,