feat: vendor gitea 1.16.2
This commit is contained in:
@@ -23,8 +23,9 @@ import (
|
||||
|
||||
// ListOwnerHooks lists the webhooks of the provided owner
|
||||
func ListOwnerHooks(ctx *context.APIContext, owner *user_model.User) {
|
||||
listOptions := GetListOptions(ctx)
|
||||
opts := &webhook.ListWebhookOptions{
|
||||
ListOptions: GetListOptions(ctx),
|
||||
ListOptions: listOptions,
|
||||
OwnerID: owner.ID,
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ func ListOwnerHooks(ctx *context.APIContext, owner *user_model.User) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx.SetLinkHeader(count, listOptions.PageSize)
|
||||
ctx.SetTotalCountHeader(count)
|
||||
ctx.JSON(http.StatusOK, apiHooks)
|
||||
}
|
||||
@@ -214,6 +215,7 @@ func addHook(ctx *context.APIContext, form *api.CreateHookOption, ownerID, repoI
|
||||
w := &webhook.Webhook{
|
||||
OwnerID: ownerID,
|
||||
RepoID: repoID,
|
||||
Name: strings.TrimSpace(form.Name),
|
||||
URL: form.Config["url"],
|
||||
ContentType: webhook.ToHookContentType(form.Config["content_type"]),
|
||||
Secret: form.Config["secret"],
|
||||
@@ -391,6 +393,10 @@ func editHook(ctx *context.APIContext, form *api.EditHookOption, w *webhook.Webh
|
||||
w.IsActive = *form.Active
|
||||
}
|
||||
|
||||
if form.Name != nil {
|
||||
w.Name = strings.TrimSpace(*form.Name)
|
||||
}
|
||||
|
||||
if err := webhook.UpdateWebhook(ctx, w); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user