diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-10-31 05:59:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 22:59:02 +0100 |
commit | 4df2ed29f28194513c59733e369152b8f8bc1d36 (patch) | |
tree | 3bb0604e902390f37e2c9a8104f4ccaf495b4291 /modules/notification/webhook/webhook.go | |
parent | dd12384f224e98a130511ebc9ffcfb44ead0e736 (diff) | |
download | gitea-4df2ed29f28194513c59733e369152b8f8bc1d36.tar.gz gitea-4df2ed29f28194513c59733e369152b8f8bc1d36.zip |
Refactor: Move PushUpdateOptions (#13363)
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Diffstat (limited to 'modules/notification/webhook/webhook.go')
-rw-r--r-- | modules/notification/webhook/webhook.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/notification/webhook/webhook.go b/modules/notification/webhook/webhook.go index 231112ec4c..9ca73db051 100644 --- a/modules/notification/webhook/webhook.go +++ b/modules/notification/webhook/webhook.go @@ -548,7 +548,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *models.User, issue *m } } -func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) { +func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { apiPusher := convert.ToUser(pusher, false, false) apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) if err != nil { @@ -557,9 +557,9 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *models.User, repo *models.Re } if err := webhook_module.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{ - Ref: refName, - Before: oldCommitID, - After: newCommitID, + Ref: opts.RefFullName, + Before: opts.OldCommitID, + After: opts.NewCommitID, CompareURL: setting.AppURL + commits.CompareURL, Commits: apiCommits, Repo: repo.APIFormat(models.AccessModeOwner), @@ -776,7 +776,7 @@ func (m *webhookNotifier) NotifyDeleteRelease(doer *models.User, rel *models.Rel sendReleaseHook(doer, rel, api.HookReleaseDeleted) } -func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, refName, oldCommitID, newCommitID string, commits *repository.PushCommits) { +func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *models.Repository, opts *repository.PushUpdateOptions, commits *repository.PushCommits) { apiPusher := convert.ToUser(pusher, false, false) apiCommits, err := commits.ToAPIPayloadCommits(repo.RepoPath(), repo.HTMLURL()) if err != nil { @@ -785,9 +785,9 @@ func (m *webhookNotifier) NotifySyncPushCommits(pusher *models.User, repo *model } if err := webhook_module.PrepareWebhooks(repo, models.HookEventPush, &api.PushPayload{ - Ref: refName, - Before: oldCommitID, - After: newCommitID, + Ref: opts.RefFullName, + Before: opts.OldCommitID, + After: opts.NewCommitID, CompareURL: setting.AppURL + commits.CompareURL, Commits: apiCommits, Repo: repo.APIFormat(models.AccessModeOwner), |