Verified Commit f59d4215 authored by Earl Warren's avatar Earl Warren
Browse files

f3: milestone is a reference, not a string

parent dc3264a9
Pipeline #2218 passed with stage
in 7 minutes and 1 second
......@@ -16,7 +16,7 @@ type PullRequest struct {
PosterID *Reference `json:"poster_id"`
Title string `json:"title"`
Content string `json:"content"`
Milestone string `json:"milestone"`
Milestone *Reference `json:"milestone"`
State string `json:"state"` // closed, open
IsLocked bool `json:"is_locked"`
Created time.Time `json:"created"`
......@@ -39,6 +39,9 @@ func (o PullRequest) GetComparers() []Comparer {
func (o *PullRequest) GetReferences() References {
references := o.Common.GetReferences()
if o.Milestone != nil {
references = append(references, o.Milestone)
}
return append(references, o.PosterID)
}
......
......@@ -48,9 +48,9 @@ func (o *pullRequest) ToFormat() f3.Interface {
return o.NewFormat()
}
var milestone string
var milestone *f3.Reference
if o.forgejoPullRequest.Milestone != nil {
milestone = o.forgejoPullRequest.Milestone.Title
milestone = f3_tree.NewIssueMilestoneReference(o.forgejoPullRequest.Milestone.ID)
}
createdAt := time.Time{}
......@@ -134,16 +134,22 @@ func (o *pullRequest) ToFormat() f3.Interface {
func (o *pullRequest) FromFormat(content f3.Interface) {
pullRequest := content.(*f3.PullRequest)
var milestone *forgejo_sdk.Milestone
if pullRequest.Milestone != nil {
milestone = &forgejo_sdk.Milestone{
ID: pullRequest.Milestone.GetIDAsInt(),
}
}
o.forgejoPullRequest = &forgejo_sdk.PullRequest{
Index: util.ParseInt(pullRequest.GetID()),
Poster: &forgejo_sdk.User{
ID: pullRequest.PosterID.GetIDAsInt(),
},
Title: pullRequest.Title,
Body: pullRequest.Content,
Milestone: &forgejo_sdk.Milestone{
Title: pullRequest.Milestone,
},
Title: pullRequest.Title,
Body: pullRequest.Content,
Milestone: milestone,
State: forgejo_sdk.StateType(pullRequest.State),
IsLocked: pullRequest.IsLocked,
HasMerged: pullRequest.Merged,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment