summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/webhook.go5
-rw-r--r--routers/api/v1/repo/hook.go6
2 files changed, 8 insertions, 3 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 01a014223b..2db0274115 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -165,13 +165,16 @@ func (w *Webhook) HasPullRequestEvent() bool {
}
func (w *Webhook) EventsArray() []string {
- events := make([]string, 0, 2)
+ events := make([]string, 0, 3)
if w.HasCreateEvent() {
events = append(events, "create")
}
if w.HasPushEvent() {
events = append(events, "push")
}
+ if w.HasPullRequestEvent() {
+ events = append(events, "pull_request")
+ }
return events
}
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 2811a4d29e..3b36055db5 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -59,8 +59,9 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
HookEvent: &models.HookEvent{
ChooseEvents: true,
HookEvents: models.HookEvents{
- Create: com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_CREATE)),
- Push: com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_PUSH)),
+ Create: com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_CREATE)),
+ Push: com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_PUSH)),
+ PullRequest: com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_PULL_REQUEST)),
},
},
IsActive: form.Active,
@@ -146,6 +147,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
w.ChooseEvents = true
w.Create = com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_CREATE))
w.Push = com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_PUSH))
+ w.PullRequest = com.IsSliceContainsStr(form.Events, string(models.HOOK_EVENT_PULL_REQUEST))
if err = w.UpdateEvent(); err != nil {
ctx.Error(500, "UpdateEvent", err)
return