Browse Source

add webhook default events

Unknwon 9 years ago
parent
commit
65843b803b
1 changed files with 6 additions and 0 deletions
  1. 6 0
      routers/api/v1/repo_hooks.go

+ 6 - 0
routers/api/v1/repo_hooks.go

@@ -76,6 +76,9 @@ func CreateRepoHook(ctx *middleware.Context, form api.CreateHookOption) {
 		return
 	}
 
+	if len(form.Events) == 0 {
+		form.Events = []string{"push"}
+	}
 	w := &models.Webhook{
 		RepoID:      ctx.Repo.Repository.ID,
 		URL:         form.Config["url"],
@@ -159,6 +162,9 @@ func EditRepoHook(ctx *middleware.Context, form api.EditHookOption) {
 	}
 
 	// Update events
+	if len(form.Events) == 0 {
+		form.Events = []string{"push"}
+	}
 	w.PushOnly = false
 	w.SendEverything = false
 	w.ChooseEvents = true