forked from forgejo/forgejo
more APIs on #12
This commit is contained in:
parent
db0026c507
commit
37d8d3afe9
10 changed files with 108 additions and 24 deletions
|
@ -107,9 +107,21 @@ func CreateRepoHook(ctx *middleware.Context, form CreateRepoHookForm) {
|
|||
return
|
||||
}
|
||||
|
||||
ctx.JSON(201, map[string]interface{}{
|
||||
"ok": true,
|
||||
})
|
||||
apiHook := &api.Hook{
|
||||
Id: w.Id,
|
||||
Type: w.HookTaskType.Name(),
|
||||
Events: []string{"push"},
|
||||
Active: w.IsActive,
|
||||
Config: map[string]string{
|
||||
"url": w.Url,
|
||||
"content_type": w.ContentType.Name(),
|
||||
},
|
||||
}
|
||||
if w.HookTaskType == models.SLACK {
|
||||
s := w.GetSlackHook()
|
||||
apiHook.Config["channel"] = s.Channel
|
||||
}
|
||||
ctx.JSON(201, apiHook)
|
||||
}
|
||||
|
||||
type EditRepoHookForm struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue