mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 10:20:39 +00:00
Granular webhook events in editHook (#19251)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
97625b44e7
commit
ea6efba9b3
1 changed files with 16 additions and 5 deletions
|
@ -245,18 +245,29 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
|
||||||
w.ChooseEvents = true
|
w.ChooseEvents = true
|
||||||
w.Create = util.IsStringInSlice(string(webhook.HookEventCreate), form.Events, true)
|
w.Create = util.IsStringInSlice(string(webhook.HookEventCreate), form.Events, true)
|
||||||
w.Push = util.IsStringInSlice(string(webhook.HookEventPush), form.Events, true)
|
w.Push = util.IsStringInSlice(string(webhook.HookEventPush), form.Events, true)
|
||||||
w.PullRequest = util.IsStringInSlice(string(webhook.HookEventPullRequest), form.Events, true)
|
|
||||||
w.Create = util.IsStringInSlice(string(webhook.HookEventCreate), form.Events, true)
|
w.Create = util.IsStringInSlice(string(webhook.HookEventCreate), form.Events, true)
|
||||||
w.Delete = util.IsStringInSlice(string(webhook.HookEventDelete), form.Events, true)
|
w.Delete = util.IsStringInSlice(string(webhook.HookEventDelete), form.Events, true)
|
||||||
w.Fork = util.IsStringInSlice(string(webhook.HookEventFork), form.Events, true)
|
w.Fork = util.IsStringInSlice(string(webhook.HookEventFork), form.Events, true)
|
||||||
w.Issues = util.IsStringInSlice(string(webhook.HookEventIssues), form.Events, true)
|
|
||||||
w.IssueComment = util.IsStringInSlice(string(webhook.HookEventIssueComment), form.Events, true)
|
|
||||||
w.Push = util.IsStringInSlice(string(webhook.HookEventPush), form.Events, true)
|
|
||||||
w.PullRequest = util.IsStringInSlice(string(webhook.HookEventPullRequest), form.Events, true)
|
|
||||||
w.Repository = util.IsStringInSlice(string(webhook.HookEventRepository), form.Events, true)
|
w.Repository = util.IsStringInSlice(string(webhook.HookEventRepository), form.Events, true)
|
||||||
w.Release = util.IsStringInSlice(string(webhook.HookEventRelease), form.Events, true)
|
w.Release = util.IsStringInSlice(string(webhook.HookEventRelease), form.Events, true)
|
||||||
w.BranchFilter = form.BranchFilter
|
w.BranchFilter = form.BranchFilter
|
||||||
|
|
||||||
|
// Issues
|
||||||
|
w.Issues = issuesHook(form.Events, "issues_only")
|
||||||
|
w.IssueAssign = issuesHook(form.Events, string(webhook.HookEventIssueAssign))
|
||||||
|
w.IssueLabel = issuesHook(form.Events, string(webhook.HookEventIssueLabel))
|
||||||
|
w.IssueMilestone = issuesHook(form.Events, string(webhook.HookEventIssueMilestone))
|
||||||
|
w.IssueComment = issuesHook(form.Events, string(webhook.HookEventIssueComment))
|
||||||
|
|
||||||
|
// Pull requests
|
||||||
|
w.PullRequest = pullHook(form.Events, "pull_request_only")
|
||||||
|
w.PullRequestAssign = pullHook(form.Events, string(webhook.HookEventPullRequestAssign))
|
||||||
|
w.PullRequestLabel = pullHook(form.Events, string(webhook.HookEventPullRequestLabel))
|
||||||
|
w.PullRequestMilestone = pullHook(form.Events, string(webhook.HookEventPullRequestMilestone))
|
||||||
|
w.PullRequestComment = pullHook(form.Events, string(webhook.HookEventPullRequestComment))
|
||||||
|
w.PullRequestReview = pullHook(form.Events, "pull_request_review")
|
||||||
|
w.PullRequestSync = pullHook(form.Events, string(webhook.HookEventPullRequestSync))
|
||||||
|
|
||||||
if err := w.UpdateEvent(); err != nil {
|
if err := w.UpdateEvent(); err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "UpdateEvent", err)
|
ctx.Error(http.StatusInternalServerError, "UpdateEvent", err)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue