1
0
Fork 0
forked from forgejo/forgejo

Move pull webhook to notification (#8805)

* Move pull webhook to notification

* fix fmt
This commit is contained in:
Lunny Xiao 2019-11-05 19:04:08 +08:00 committed by GitHub
parent 05e7715c4b
commit aaeef295bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 84 additions and 71 deletions

View file

@ -11,8 +11,6 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/webhook"
issue_service "code.gitea.io/gitea/services/issue"
)
@ -90,23 +88,9 @@ func AddTestPullRequestTask(doer *models.User, repoID int64, branch string, isSy
if err == nil {
for _, pr := range prs {
pr.Issue.PullRequest = pr
if err = pr.Issue.LoadAttributes(); err != nil {
log.Error("LoadAttributes: %v", err)
continue
}
if err = webhook.PrepareWebhooks(pr.Issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
Action: api.HookIssueSynchronized,
Index: pr.Issue.Index,
PullRequest: pr.Issue.PullRequest.APIFormat(),
Repository: pr.Issue.Repo.APIFormat(models.AccessModeNone),
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks [pull_id: %v]: %v", pr.ID, err)
continue
}
notification.NotifyPullRequestSynchronized(doer, pr)
}
}
}
addHeadRepoTasks(prs)