mirror of
https://github.com/go-gitea/gitea
synced 2025-07-12 13:37:20 +00:00
Refactor webhook events (#33337)
Extract from #33320 This PR uses a map instead of a struct to store webhook event information. It removes many duplicated functions and makes the logic clearer.
This commit is contained in:
@ -163,27 +163,27 @@ func ParseHookEvent(form forms.WebhookForm) *webhook_module.HookEvent {
|
||||
SendEverything: form.SendEverything(),
|
||||
ChooseEvents: form.ChooseEvents(),
|
||||
HookEvents: webhook_module.HookEvents{
|
||||
Create: form.Create,
|
||||
Delete: form.Delete,
|
||||
Fork: form.Fork,
|
||||
Issues: form.Issues,
|
||||
IssueAssign: form.IssueAssign,
|
||||
IssueLabel: form.IssueLabel,
|
||||
IssueMilestone: form.IssueMilestone,
|
||||
IssueComment: form.IssueComment,
|
||||
Release: form.Release,
|
||||
Push: form.Push,
|
||||
PullRequest: form.PullRequest,
|
||||
PullRequestAssign: form.PullRequestAssign,
|
||||
PullRequestLabel: form.PullRequestLabel,
|
||||
PullRequestMilestone: form.PullRequestMilestone,
|
||||
PullRequestComment: form.PullRequestComment,
|
||||
PullRequestReview: form.PullRequestReview,
|
||||
PullRequestSync: form.PullRequestSync,
|
||||
PullRequestReviewRequest: form.PullRequestReviewRequest,
|
||||
Wiki: form.Wiki,
|
||||
Repository: form.Repository,
|
||||
Package: form.Package,
|
||||
webhook_module.HookEventCreate: form.Create,
|
||||
webhook_module.HookEventDelete: form.Delete,
|
||||
webhook_module.HookEventFork: form.Fork,
|
||||
webhook_module.HookEventIssues: form.Issues,
|
||||
webhook_module.HookEventIssueAssign: form.IssueAssign,
|
||||
webhook_module.HookEventIssueLabel: form.IssueLabel,
|
||||
webhook_module.HookEventIssueMilestone: form.IssueMilestone,
|
||||
webhook_module.HookEventIssueComment: form.IssueComment,
|
||||
webhook_module.HookEventRelease: form.Release,
|
||||
webhook_module.HookEventPush: form.Push,
|
||||
webhook_module.HookEventPullRequest: form.PullRequest,
|
||||
webhook_module.HookEventPullRequestAssign: form.PullRequestAssign,
|
||||
webhook_module.HookEventPullRequestLabel: form.PullRequestLabel,
|
||||
webhook_module.HookEventPullRequestMilestone: form.PullRequestMilestone,
|
||||
webhook_module.HookEventPullRequestComment: form.PullRequestComment,
|
||||
webhook_module.HookEventPullRequestReview: form.PullRequestReview,
|
||||
webhook_module.HookEventPullRequestSync: form.PullRequestSync,
|
||||
webhook_module.HookEventPullRequestReviewRequest: form.PullRequestReviewRequest,
|
||||
webhook_module.HookEventWiki: form.Wiki,
|
||||
webhook_module.HookEventRepository: form.Repository,
|
||||
webhook_module.HookEventPackage: form.Package,
|
||||
},
|
||||
BranchFilter: form.BranchFilter,
|
||||
}
|
||||
|
Reference in New Issue
Block a user