diff options
author | Unknwon <u@gogs.io> | 2016-08-16 10:19:09 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-16 10:19:09 -0700 |
commit | 6f9a95f83020e215ebe3942bd541da34791dd043 (patch) | |
tree | 9d95bc94e2346c808863377f79708d32decb8908 /models/pull.go | |
parent | 8bf57be9ba82d7b5289c894c902b5ecaaa1142bf (diff) | |
download | gitea-6f9a95f83020e215ebe3942bd541da34791dd043.tar.gz gitea-6f9a95f83020e215ebe3942bd541da34791dd043.zip |
#2246 add HTMLURL to webhook type
- Fill Milestone and Assignee field when available in webhook payload
Diffstat (limited to 'models/pull.go')
-rw-r--r-- | models/pull.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/models/pull.go b/models/pull.go index fb967cd306..472c87b52b 100644 --- a/models/pull.go +++ b/models/pull.go @@ -100,6 +100,10 @@ func (pr *PullRequest) LoadAttributes() error { } func (pr *PullRequest) LoadIssue() (err error) { + if pr.Issue != nil { + return nil + } + pr.Issue, err = GetIssueByID(pr.IssueID) return err } @@ -112,14 +116,15 @@ func (pr *PullRequest) APIFormat() *api.PullRequest { apiPullRequest := &api.PullRequest{ ID: pr.ID, Index: pr.Index, - State: apiIssue.State, + Poster: apiIssue.Poster, Title: apiIssue.Title, Body: apiIssue.Body, - User: apiIssue.User, Labels: apiIssue.Labels, Milestone: apiIssue.Milestone, Assignee: apiIssue.Assignee, + State: apiIssue.State, Comments: apiIssue.Comments, + HTMLURL: pr.Issue.HTMLURL(), HasMerged: pr.HasMerged, } @@ -312,7 +317,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error Before: pr.MergeBase, After: pr.MergedCommitID, CompareURL: setting.AppUrl + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID), - Commits: ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.FullLink()), + Commits: ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.HTMLURL()), Repo: pr.BaseRepo.APIFormat(nil), Pusher: pr.HeadRepo.MustOwner().APIFormat(), Sender: doer.APIFormat(), |