|
|
|
@ -13,7 +13,7 @@ import (
|
|
|
|
|
"code.gitea.io/gitea/modules/repository"
|
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
|
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
|
|
|
|
webhook_module "code.gitea.io/gitea/modules/webhook"
|
|
|
|
|
webhook_services "code.gitea.io/gitea/services/webhook"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type webhookNotifier struct {
|
|
|
|
@ -48,7 +48,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestLabel, &api.PullRequestPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequestLabel, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueLabelCleared,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest),
|
|
|
|
@ -56,7 +56,7 @@ func (m *webhookNotifier) NotifyIssueClearLabels(doer *models.User, issue *model
|
|
|
|
|
Sender: convert.ToUser(doer, false, false),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{
|
|
|
|
|
Action: api.HookIssueLabelCleared,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Issue: convert.ToAPIIssue(issue),
|
|
|
|
@ -74,7 +74,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo
|
|
|
|
|
mode, _ := models.AccessLevel(doer, repo)
|
|
|
|
|
|
|
|
|
|
// forked webhook
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(oldRepo, models.HookEventFork, &api.ForkPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(oldRepo, models.HookEventFork, &api.ForkPayload{
|
|
|
|
|
Forkee: convert.ToRepo(oldRepo, oldMode),
|
|
|
|
|
Repo: convert.ToRepo(repo, mode),
|
|
|
|
|
Sender: convert.ToUser(doer, false, false),
|
|
|
|
@ -86,7 +86,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo
|
|
|
|
|
|
|
|
|
|
// Add to hook queue for created repo after session commit.
|
|
|
|
|
if u.IsOrganization() {
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoCreated,
|
|
|
|
|
Repository: convert.ToRepo(repo, models.AccessModeOwner),
|
|
|
|
|
Organization: convert.ToUser(u, false, false),
|
|
|
|
@ -99,7 +99,7 @@ func (m *webhookNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo
|
|
|
|
|
|
|
|
|
|
func (m *webhookNotifier) NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) {
|
|
|
|
|
// Add to hook queue for created repo after session commit.
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoCreated,
|
|
|
|
|
Repository: convert.ToRepo(repo, models.AccessModeOwner),
|
|
|
|
|
Organization: convert.ToUser(u, false, false),
|
|
|
|
@ -112,7 +112,7 @@ func (m *webhookNotifier) NotifyCreateRepository(doer *models.User, u *models.Us
|
|
|
|
|
func (m *webhookNotifier) NotifyDeleteRepository(doer *models.User, repo *models.Repository) {
|
|
|
|
|
u := repo.MustOwner()
|
|
|
|
|
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(repo, models.HookEventRepository, &api.RepositoryPayload{
|
|
|
|
|
Action: api.HookRepoDeleted,
|
|
|
|
|
Repository: convert.ToRepo(repo, models.AccessModeOwner),
|
|
|
|
|
Organization: convert.ToUser(u, false, false),
|
|
|
|
@ -143,7 +143,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo
|
|
|
|
|
apiPullRequest.Action = api.HookIssueAssigned
|
|
|
|
|
}
|
|
|
|
|
// Assignee comment triggers a webhook
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestAssign, apiPullRequest); err != nil {
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequestAssign, apiPullRequest); err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v", issue.IsPull, removed, err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -161,7 +161,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *mo
|
|
|
|
|
apiIssue.Action = api.HookIssueAssigned
|
|
|
|
|
}
|
|
|
|
|
// Assignee comment triggers a webhook
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueAssign, apiIssue); err != nil {
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueAssign, apiIssue); err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [is_pull: %v, remove_assignee: %v]: %v", issue.IsPull, removed, err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
@ -177,7 +177,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
issue.PullRequest.Issue = issue
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueEdited,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Changes: &api.ChangesPayload{
|
|
|
|
@ -190,7 +190,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *models.User, issue *model
|
|
|
|
|
Sender: convert.ToUser(doer, false, false),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
|
|
|
|
|
Action: api.HookIssueEdited,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Changes: &api.ChangesPayload{
|
|
|
|
@ -229,7 +229,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode
|
|
|
|
|
} else {
|
|
|
|
|
apiPullRequest.Action = api.HookIssueReOpened
|
|
|
|
|
}
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, apiPullRequest)
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, apiPullRequest)
|
|
|
|
|
} else {
|
|
|
|
|
apiIssue := &api.IssuePayload{
|
|
|
|
|
Index: issue.Index,
|
|
|
|
@ -242,7 +242,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *models.User, issue *mode
|
|
|
|
|
} else {
|
|
|
|
|
apiIssue.Action = api.HookIssueReOpened
|
|
|
|
|
}
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, apiIssue)
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssues, apiIssue)
|
|
|
|
|
}
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks [is_pull: %v, is_closed: %v]: %v", issue.IsPull, isClosed, err)
|
|
|
|
@ -260,7 +260,7 @@ func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mode, _ := models.AccessLevel(issue.Poster, issue.Repo)
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
|
|
|
|
|
Action: api.HookIssueOpened,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Issue: convert.ToAPIIssue(issue),
|
|
|
|
@ -286,7 +286,7 @@ func (m *webhookNotifier) NotifyNewPullRequest(pull *models.PullRequest) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mode, _ := models.AccessLevel(pull.Issue.Poster, pull.Issue.Repo)
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(pull.Issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(pull.Issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueOpened,
|
|
|
|
|
Index: pull.Issue.Index,
|
|
|
|
|
PullRequest: convert.ToAPIPullRequest(pull),
|
|
|
|
@ -302,7 +302,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod
|
|
|
|
|
var err error
|
|
|
|
|
if issue.IsPull {
|
|
|
|
|
issue.PullRequest.Issue = issue
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueEdited,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Changes: &api.ChangesPayload{
|
|
|
|
@ -315,7 +315,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *models.User, issue *mod
|
|
|
|
|
Sender: convert.ToUser(doer, false, false),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssues, &api.IssuePayload{
|
|
|
|
|
Action: api.HookIssueEdited,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Changes: &api.ChangesPayload{
|
|
|
|
@ -352,7 +352,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme
|
|
|
|
|
|
|
|
|
|
mode, _ := models.AccessLevel(doer, c.Issue.Repo)
|
|
|
|
|
if c.Issue.IsPull {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(c.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(c.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{
|
|
|
|
|
Action: api.HookIssueCommentEdited,
|
|
|
|
|
Issue: convert.ToAPIIssue(c.Issue),
|
|
|
|
|
Comment: convert.ToComment(c),
|
|
|
|
@ -366,7 +366,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *models.User, c *models.Comme
|
|
|
|
|
IsPull: true,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(c.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(c.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
|
|
|
|
|
Action: api.HookIssueCommentEdited,
|
|
|
|
|
Issue: convert.ToAPIIssue(c.Issue),
|
|
|
|
|
Comment: convert.ToComment(c),
|
|
|
|
@ -392,7 +392,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode
|
|
|
|
|
|
|
|
|
|
var err error
|
|
|
|
|
if issue.IsPull {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{
|
|
|
|
|
Action: api.HookIssueCommentCreated,
|
|
|
|
|
Issue: convert.ToAPIIssue(issue),
|
|
|
|
|
Comment: convert.ToComment(comment),
|
|
|
|
@ -401,7 +401,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *models.User, repo *mode
|
|
|
|
|
IsPull: true,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
|
|
|
|
|
Action: api.HookIssueCommentCreated,
|
|
|
|
|
Issue: convert.ToAPIIssue(issue),
|
|
|
|
|
Comment: convert.ToComment(comment),
|
|
|
|
@ -436,7 +436,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models
|
|
|
|
|
mode, _ := models.AccessLevel(doer, comment.Issue.Repo)
|
|
|
|
|
|
|
|
|
|
if comment.Issue.IsPull {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(comment.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(comment.Issue.Repo, models.HookEventPullRequestComment, &api.IssueCommentPayload{
|
|
|
|
|
Action: api.HookIssueCommentDeleted,
|
|
|
|
|
Issue: convert.ToAPIIssue(comment.Issue),
|
|
|
|
|
Comment: convert.ToComment(comment),
|
|
|
|
@ -445,7 +445,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *models.User, comment *models
|
|
|
|
|
IsPull: true,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(comment.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(comment.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
|
|
|
|
|
Action: api.HookIssueCommentDeleted,
|
|
|
|
|
Issue: convert.ToAPIIssue(comment.Issue),
|
|
|
|
|
Comment: convert.ToComment(comment),
|
|
|
|
@ -485,7 +485,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode
|
|
|
|
|
log.Error("LoadIssue: %v", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestLabel, &api.PullRequestPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequestLabel, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueLabelUpdated,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest),
|
|
|
|
@ -493,7 +493,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *models.User, issue *mode
|
|
|
|
|
Sender: convert.ToUser(doer, false, false),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueLabel, &api.IssuePayload{
|
|
|
|
|
Action: api.HookIssueLabelUpdated,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Issue: convert.ToAPIIssue(issue),
|
|
|
|
@ -527,7 +527,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m
|
|
|
|
|
log.Error("LoadIssue: %v", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequestMilestone, &api.PullRequestPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequestMilestone, &api.PullRequestPayload{
|
|
|
|
|
Action: hookAction,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
PullRequest: convert.ToAPIPullRequest(issue.PullRequest),
|
|
|
|
@ -535,7 +535,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m
|
|
|
|
|
Sender: convert.ToUser(doer, false, false),
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventIssueMilestone, &api.IssuePayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventIssueMilestone, &api.IssuePayload{
|
|
|
|
|
Action: hookAction,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Issue: convert.ToAPIIssue(issue),
|
|
|
|
@ -556,7 +556,7 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
|
|
|
|
|
Ref: opts.RefFullName,
|
|
|
|
|
Before: opts.OldCommitID,
|
|
|
|
|
After: opts.NewCommitID,
|
|
|
|
@ -602,7 +602,7 @@ func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mod
|
|
|
|
|
Action: api.HookIssueClosed,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = webhook_module.PrepareWebhooks(pr.Issue.Repo, models.HookEventPullRequest, apiPullRequest)
|
|
|
|
|
err = webhook_services.PrepareWebhooks(pr.Issue.Repo, models.HookEventPullRequest, apiPullRequest)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Error("PrepareWebhooks: %v", err)
|
|
|
|
|
}
|
|
|
|
@ -621,7 +621,7 @@ func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *models.User,
|
|
|
|
|
}
|
|
|
|
|
issue.PullRequest.Issue = issue
|
|
|
|
|
mode, _ := models.AccessLevel(issue.Poster, issue.Repo)
|
|
|
|
|
err = webhook_module.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
err = webhook_services.PrepareWebhooks(issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueEdited,
|
|
|
|
|
Index: issue.Index,
|
|
|
|
|
Changes: &api.ChangesPayload{
|
|
|
|
@ -665,7 +665,7 @@ func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
|
|
|
|
|
log.Error("models.AccessLevel: %v", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(review.Issue.Repo, reviewHookType, &api.PullRequestPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(review.Issue.Repo, reviewHookType, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueReviewed,
|
|
|
|
|
Index: review.Issue.Index,
|
|
|
|
|
PullRequest: convert.ToAPIPullRequest(pr),
|
|
|
|
@ -699,7 +699,7 @@ func (m *webhookNotifier) NotifyCreateRef(pusher *models.User, repo *models.Repo
|
|
|
|
|
}
|
|
|
|
|
gitRepo.Close()
|
|
|
|
|
|
|
|
|
|
if err = webhook_module.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{
|
|
|
|
|
if err = webhook_services.PrepareWebhooks(repo, models.HookEventCreate, &api.CreatePayload{
|
|
|
|
|
Ref: refName,
|
|
|
|
|
Sha: shaSum,
|
|
|
|
|
RefType: refType,
|
|
|
|
@ -720,7 +720,7 @@ func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *models.User, pr *m
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(pr.Issue.Repo, models.HookEventPullRequestSync, &api.PullRequestPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(pr.Issue.Repo, models.HookEventPullRequestSync, &api.PullRequestPayload{
|
|
|
|
|
Action: api.HookIssueSynchronized,
|
|
|
|
|
Index: pr.Issue.Index,
|
|
|
|
|
PullRequest: convert.ToAPIPullRequest(pr),
|
|
|
|
@ -736,7 +736,7 @@ func (m *webhookNotifier) NotifyDeleteRef(pusher *models.User, repo *models.Repo
|
|
|
|
|
apiRepo := convert.ToRepo(repo, models.AccessModeNone)
|
|
|
|
|
refName := git.RefEndName(refFullName)
|
|
|
|
|
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(repo, models.HookEventDelete, &api.DeletePayload{
|
|
|
|
|
Ref: refName,
|
|
|
|
|
RefType: refType,
|
|
|
|
|
PusherType: api.PusherTypeUser,
|
|
|
|
@ -754,7 +754,7 @@ func sendReleaseHook(doer *models.User, rel *models.Release, action api.HookRele
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mode, _ := models.AccessLevel(rel.Publisher, rel.Repo)
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(rel.Repo, models.HookEventRelease, &api.ReleasePayload{
|
|
|
|
|
Action: action,
|
|
|
|
|
Release: convert.ToRelease(rel),
|
|
|
|
|
Repository: convert.ToRepo(rel.Repo, mode),
|
|
|
|
@ -784,7 +784,7 @@ func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *model
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := webhook_module.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
|
|
|
|
|
if err := webhook_services.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{
|
|
|
|
|
Ref: opts.RefFullName,
|
|
|
|
|
Before: opts.OldCommitID,
|
|
|
|
|
After: opts.NewCommitID,
|
|
|
|
|