diff options
Diffstat (limited to 'models/pull.go')
-rw-r--r-- | models/pull.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/models/pull.go b/models/pull.go index d23d885b6c..90b341907d 100644 --- a/models/pull.go +++ b/models/pull.go @@ -457,15 +457,18 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle log.Error(4, "LoadAttributes: %v", err) return nil } + + mode, _ := AccessLevel(doer.ID, pr.Issue.Repo) if err = PrepareWebhooks(pr.Issue.Repo, HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueClosed, Index: pr.Index, PullRequest: pr.APIFormat(), - Repository: pr.Issue.Repo.APIFormat(AccessModeNone), + Repository: pr.Issue.Repo.APIFormat(mode), Sender: doer.APIFormat(), }); err != nil { log.Error(4, "PrepareWebhooks: %v", err) - return nil + } else { + go HookQueue.Add(pr.Issue.Repo.ID) } l, err := baseGitRepo.CommitsBetweenIDs(pr.MergedCommitID, pr.MergeBase) @@ -492,12 +495,14 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle After: mergeCommit.ID.String(), CompareURL: setting.AppURL + pr.BaseRepo.ComposeCompareURL(pr.MergeBase, pr.MergedCommitID), Commits: ListToPushCommits(l).ToAPIPayloadCommits(pr.BaseRepo.HTMLURL()), - Repo: pr.BaseRepo.APIFormat(AccessModeNone), + Repo: pr.BaseRepo.APIFormat(mode), Pusher: pr.HeadRepo.MustOwner().APIFormat(), Sender: doer.APIFormat(), } if err = PrepareWebhooks(pr.BaseRepo, HookEventPush, p); err != nil { - return fmt.Errorf("PrepareWebhooks: %v", err) + log.Error(4, "PrepareWebhooks: %v", err) + } else { + go HookQueue.Add(pr.BaseRepo.ID) } return nil } @@ -782,16 +787,18 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str pr.Issue = pull pull.PullRequest = pr + mode, _ := AccessLevel(pull.Poster.ID, repo) if err = PrepareWebhooks(repo, HookEventPullRequest, &api.PullRequestPayload{ Action: api.HookIssueOpened, Index: pull.Index, PullRequest: pr.APIFormat(), - Repository: repo.APIFormat(AccessModeNone), + Repository: repo.APIFormat(mode), Sender: pull.Poster.APIFormat(), }); err != nil { log.Error(4, "PrepareWebhooks: %v", err) + } else { + go HookQueue.Add(repo.ID) } - go HookQueue.Add(repo.ID) return nil } |