diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-03 14:59:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-03 14:59:26 +0800 |
commit | 022d2d8beb6297016ed26b0090c6a4a4ac404437 (patch) | |
tree | aa6ca5fa9415661d02e97b66251166d456efa18e /modules/repofiles | |
parent | fe7a6d9bfcbcf53bfe2d24f4d8e7463c897b9389 (diff) | |
download | gitea-022d2d8beb6297016ed26b0090c6a4a4ac404437.tar.gz gitea-022d2d8beb6297016ed26b0090c6a4a4ac404437.zip |
Move push commits events to notification (#8783)
* Move push commits events to notification
* Update modules/notification/base/null.go
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'modules/repofiles')
-rw-r--r-- | modules/repofiles/action.go | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/modules/repofiles/action.go b/modules/repofiles/action.go index 79f6406c53..e5f6bf8718 100644 --- a/modules/repofiles/action.go +++ b/modules/repofiles/action.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models" "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/webhook" @@ -190,22 +191,7 @@ func CommitRepoAction(opts CommitRepoActionOptions) error { } if isHookEventPush { - commits, err := opts.Commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) - if err != nil { - return err - } - if err = webhook.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{ - Ref: opts.RefFullName, - Before: opts.OldCommitID, - After: opts.NewCommitID, - CompareURL: setting.AppURL + opts.Commits.CompareURL, - Commits: commits, - Repo: apiRepo, - Pusher: apiPusher, - Sender: apiPusher, - }); err != nil { - return fmt.Errorf("PrepareWebhooks: %v", err) - } + notification.NotifyPushCommits(pusher, repo, opts.RefFullName, opts.OldCommitID, opts.NewCommitID, opts.Commits) } return nil |