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: // This method assumes following fields have been assigned with valid values:
// Required - Issue // Required - Issue
// Required - HeadRepo
// Required - BaseRepo
// Optional - Merger // Optional - Merger
func (pr *PullRequest) APIFormat() *api.PullRequest { func (pr *PullRequest) APIFormat() *api.PullRequest {
apiIssue := pr.Issue.APIFormat() apiIssue := pr.Issue.APIFormat()
apiPullRequest := &api.PullRequest{ apiPullRequest := &api.PullRequest{
ID: pr.ID, ID: pr.ID,
Index: pr.Index, Index: pr.Index,
Poster: apiIssue.Poster, Poster: apiIssue.Poster,
Title: apiIssue.Title, Title: apiIssue.Title,
Body: apiIssue.Body, Body: apiIssue.Body,
Labels: apiIssue.Labels, Labels: apiIssue.Labels,
Milestone: apiIssue.Milestone, Milestone: apiIssue.Milestone,
Assignee: apiIssue.Assignee, Assignee: apiIssue.Assignee,
State: apiIssue.State, State: apiIssue.State,
Comments: apiIssue.Comments, Comments: apiIssue.Comments,
HTMLURL: pr.Issue.HTMLURL(), HeadBranch: pr.HeadBranch,
HasMerged: pr.HasMerged, 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 { if pr.Status != PULL_REQUEST_STATUS_CHECKING {

Loading…
Cancel
Save