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

@ -20,10 +20,9 @@ import (
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/webhook"
"github.com/mcuadros/go-version"
)
@ -360,16 +359,7 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
return nil
}
mode, _ := models.AccessLevel(doer, pr.Issue.Repo)
if err = webhook.PrepareWebhooks(pr.Issue.Repo, models.HookEventPullRequest, &api.PullRequestPayload{
Action: api.HookIssueClosed,
Index: pr.Index,
PullRequest: pr.APIFormat(),
Repository: pr.Issue.Repo.APIFormat(mode),
Sender: doer.APIFormat(),
}); err != nil {
log.Error("PrepareWebhooks: %v", err)
}
notification.NotifyIssueChangeStatus(doer, pr.Issue, true)
return nil
}