Browse Source

PR Webhook - Add base/head info (#3547)

* messing with getting local go-gogs-client

* coding style fix

* added comments for required fields
pull/3740/merge
Kurt Madel 8 years ago committed by 无闻
parent
commit
3b0e2c1c3f
  1. 30
      models/pull.go

30
models/pull.go

@ -113,22 +113,28 @@ func (pr *PullRequest) LoadIssue() (err error) {
// This method assumes following fields have been assigned with valid values:
// Required - Issue
// Required - HeadRepo
// Required - BaseRepo
// Optional - Merger
func (pr *PullRequest) APIFormat() *api.PullRequest {
apiIssue := pr.Issue.APIFormat()
apiPullRequest := &api.PullRequest{
ID: pr.ID,
Index: pr.Index,
Poster: apiIssue.Poster,
Title: apiIssue.Title,
Body: apiIssue.Body,
Labels: apiIssue.Labels,
Milestone: apiIssue.Milestone,
Assignee: apiIssue.Assignee,
State: apiIssue.State,
Comments: apiIssue.Comments,
HTMLURL: pr.Issue.HTMLURL(),
HasMerged: pr.HasMerged,
ID: pr.ID,
Index: pr.Index,
Poster: apiIssue.Poster,
Title: apiIssue.Title,
Body: apiIssue.Body,
Labels: apiIssue.Labels,
Milestone: apiIssue.Milestone,
Assignee: apiIssue.Assignee,
State: apiIssue.State,
Comments: apiIssue.Comments,
HeadBranch: pr.HeadBranch,
HeadRepo: pr.HeadRepo.APIFormat(nil),
BaseBranch: pr.BaseBranch,
BaseRepo: pr.BaseRepo.APIFormat(nil),
HTMLURL: pr.Issue.HTMLURL(),
HasMerged: pr.HasMerged,
}
if pr.Status != PULL_REQUEST_STATUS_CHECKING {

Loading…
Cancel
Save