summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/utils/hook.go
diff options
context:
space:
mode:
authorWGH <wgh@torlan.ru>2019-09-09 07:48:21 +0200
committerLauris BH <lauris.buksis@zzdats.lv>2019-09-09 07:48:21 +0200
commit6ddd3b0b470d16dfe62caf5fff21011cfff44a76 (patch)
tree05d4c7fedf8af21b489003890be000f839f69a51 /routers/api/v1/utils/hook.go
parentAdd option to initialize repository with labels (#6061) (diff)
downloadforgejo-6ddd3b0b470d16dfe62caf5fff21011cfff44a76.tar.xz
forgejo-6ddd3b0b470d16dfe62caf5fff21011cfff44a76.zip
Implement webhook branch filter (#7791)
* Fix validate() function to handle errors in embedded anon structs * Implement webhook branch filter See #2025, #3998.
Diffstat (limited to 'routers/api/v1/utils/hook.go')
-rw-r--r--routers/api/v1/utils/hook.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/api/v1/utils/hook.go b/routers/api/v1/utils/hook.go
index 0b00e59ade..7903d58334 100644
--- a/routers/api/v1/utils/hook.go
+++ b/routers/api/v1/utils/hook.go
@@ -112,6 +112,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, orgID, repoID
Repository: com.IsSliceContainsStr(form.Events, string(models.HookEventRepository)),
Release: com.IsSliceContainsStr(form.Events, string(models.HookEventRelease)),
},
+ BranchFilter: form.BranchFilter,
},
IsActive: form.Active,
HookTaskType: models.ToHookTaskType(form.Type),
@@ -236,6 +237,7 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *models.Webho
w.PullRequest = com.IsSliceContainsStr(form.Events, string(models.HookEventPullRequest))
w.Repository = com.IsSliceContainsStr(form.Events, string(models.HookEventRepository))
w.Release = com.IsSliceContainsStr(form.Events, string(models.HookEventRelease))
+ w.BranchFilter = form.BranchFilter
if err := w.UpdateEvent(); err != nil {
ctx.Error(500, "UpdateEvent", err)