[REFACTOR] webhook repo naming consistency
This commit is contained in:
parent
9c3611ec50
commit
bc36f85b5f
2 changed files with 27 additions and 27 deletions
|
@ -39,8 +39,8 @@ const (
|
||||||
tplAdminHookNew base.TplName = "admin/hook_new"
|
tplAdminHookNew base.TplName = "admin/hook_new"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Webhooks render web hooks list page
|
// WebhookList render web hooks list page
|
||||||
func Webhooks(ctx *context.Context) {
|
func WebhookList(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
|
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
ctx.Data["BaseLink"] = ctx.Repo.RepoLink + "/settings/hooks"
|
ctx.Data["BaseLink"] = ctx.Repo.RepoLink + "/settings/hooks"
|
||||||
|
@ -109,8 +109,8 @@ func getOwnerRepoCtx(ctx *context.Context) (*ownerRepoCtx, error) {
|
||||||
return nil, errors.New("unable to set OwnerRepo context")
|
return nil, errors.New("unable to set OwnerRepo context")
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebhooksNew render creating webhook page
|
// WebhookNew render creating webhook page
|
||||||
func WebhooksNew(ctx *context.Context) {
|
func WebhookNew(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||||
ctx.Data["Webhook"] = webhook.Webhook{HookEvent: &webhook_module.HookEvent{}}
|
ctx.Data["Webhook"] = webhook.Webhook{HookEvent: &webhook_module.HookEvent{}}
|
||||||
|
|
||||||
|
@ -367,8 +367,8 @@ func checkWebhook(ctx *context.Context) (*ownerRepoCtx, *webhook.Webhook) {
|
||||||
return orCtx, w
|
return orCtx, w
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebHooksEdit render editing web hook page
|
// WebhookEdit render editing web hook page
|
||||||
func WebHooksEdit(ctx *context.Context) {
|
func WebhookEdit(ctx *context.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
||||||
ctx.Data["PageIsSettingsHooks"] = true
|
ctx.Data["PageIsSettingsHooks"] = true
|
||||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||||
|
@ -382,8 +382,8 @@ func WebHooksEdit(ctx *context.Context) {
|
||||||
ctx.HTML(http.StatusOK, orCtx.NewTemplate)
|
ctx.HTML(http.StatusOK, orCtx.NewTemplate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestWebhook test if web hook is work fine
|
// WebhookTest test if web hook is work fine
|
||||||
func TestWebhook(ctx *context.Context) {
|
func WebhookTest(ctx *context.Context) {
|
||||||
hookID := ctx.ParamsInt64(":id")
|
hookID := ctx.ParamsInt64(":id")
|
||||||
w, err := webhook.GetWebhookByRepoID(ctx, ctx.Repo.Repository.ID, hookID)
|
w, err := webhook.GetWebhookByRepoID(ctx, ctx.Repo.Repository.ID, hookID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -443,8 +443,8 @@ func TestWebhook(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReplayWebhook replays a webhook
|
// WebhookReplay replays a webhook
|
||||||
func ReplayWebhook(ctx *context.Context) {
|
func WebhookReplay(ctx *context.Context) {
|
||||||
hookTaskUUID := ctx.Params(":uuid")
|
hookTaskUUID := ctx.Params(":uuid")
|
||||||
|
|
||||||
orCtx, w := checkWebhook(ctx)
|
orCtx, w := checkWebhook(ctx)
|
||||||
|
@ -465,8 +465,8 @@ func ReplayWebhook(ctx *context.Context) {
|
||||||
ctx.Redirect(fmt.Sprintf("%s/%d", orCtx.Link, w.ID))
|
ctx.Redirect(fmt.Sprintf("%s/%d", orCtx.Link, w.ID))
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteWebhook delete a webhook
|
// WebhookDelete delete a webhook
|
||||||
func DeleteWebhook(ctx *context.Context) {
|
func WebhookDelete(ctx *context.Context) {
|
||||||
if err := webhook.DeleteWebhookByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormInt64("id")); err != nil {
|
if err := webhook.DeleteWebhookByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormInt64("id")); err != nil {
|
||||||
ctx.Flash.Error("DeleteWebhookByRepoID: " + err.Error())
|
ctx.Flash.Error("DeleteWebhookByRepoID: " + err.Error())
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -609,12 +609,12 @@ func registerRoutes(m *web.Route) {
|
||||||
m.Group("/hooks", func() {
|
m.Group("/hooks", func() {
|
||||||
m.Get("", user_setting.Webhooks)
|
m.Get("", user_setting.Webhooks)
|
||||||
m.Post("/delete", user_setting.DeleteWebhook)
|
m.Post("/delete", user_setting.DeleteWebhook)
|
||||||
m.Get("/{type}/new", repo_setting.WebhooksNew)
|
m.Get("/{type}/new", repo_setting.WebhookNew)
|
||||||
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
||||||
m.Group("/{id}", func() {
|
m.Group("/{id}", func() {
|
||||||
m.Get("", repo_setting.WebHooksEdit)
|
m.Get("", repo_setting.WebhookEdit)
|
||||||
m.Post("", repo_setting.WebhookUpdate)
|
m.Post("", repo_setting.WebhookUpdate)
|
||||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||||
})
|
})
|
||||||
}, webhooksEnabled)
|
}, webhooksEnabled)
|
||||||
|
|
||||||
|
@ -714,14 +714,14 @@ func registerRoutes(m *web.Route) {
|
||||||
m.Get("", admin.DefaultOrSystemWebhooks)
|
m.Get("", admin.DefaultOrSystemWebhooks)
|
||||||
m.Post("/delete", admin.DeleteDefaultOrSystemWebhook)
|
m.Post("/delete", admin.DeleteDefaultOrSystemWebhook)
|
||||||
m.Group("/{id}", func() {
|
m.Group("/{id}", func() {
|
||||||
m.Get("", repo_setting.WebHooksEdit)
|
m.Get("", repo_setting.WebhookEdit)
|
||||||
m.Post("", repo_setting.WebhookUpdate)
|
m.Post("", repo_setting.WebhookUpdate)
|
||||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||||
})
|
})
|
||||||
}, webhooksEnabled)
|
}, webhooksEnabled)
|
||||||
|
|
||||||
m.Group("/{configType:default-hooks|system-hooks}", func() {
|
m.Group("/{configType:default-hooks|system-hooks}", func() {
|
||||||
m.Get("/{type}/new", repo_setting.WebhooksNew)
|
m.Get("/{type}/new", repo_setting.WebhookNew)
|
||||||
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -880,12 +880,12 @@ func registerRoutes(m *web.Route) {
|
||||||
m.Group("/hooks", func() {
|
m.Group("/hooks", func() {
|
||||||
m.Get("", org.Webhooks)
|
m.Get("", org.Webhooks)
|
||||||
m.Post("/delete", org.DeleteWebhook)
|
m.Post("/delete", org.DeleteWebhook)
|
||||||
m.Get("/{type}/new", repo_setting.WebhooksNew)
|
m.Get("/{type}/new", repo_setting.WebhookNew)
|
||||||
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
||||||
m.Group("/{id}", func() {
|
m.Group("/{id}", func() {
|
||||||
m.Get("", repo_setting.WebHooksEdit)
|
m.Get("", repo_setting.WebhookEdit)
|
||||||
m.Post("", repo_setting.WebhookUpdate)
|
m.Post("", repo_setting.WebhookUpdate)
|
||||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||||
})
|
})
|
||||||
}, webhooksEnabled)
|
}, webhooksEnabled)
|
||||||
|
|
||||||
|
@ -1053,15 +1053,15 @@ func registerRoutes(m *web.Route) {
|
||||||
}, context.GitHookService())
|
}, context.GitHookService())
|
||||||
|
|
||||||
m.Group("/hooks", func() {
|
m.Group("/hooks", func() {
|
||||||
m.Get("", repo_setting.Webhooks)
|
m.Get("", repo_setting.WebhookList)
|
||||||
m.Post("/delete", repo_setting.DeleteWebhook)
|
m.Post("/delete", repo_setting.WebhookDelete)
|
||||||
m.Get("/{type}/new", repo_setting.WebhooksNew)
|
m.Get("/{type}/new", repo_setting.WebhookNew)
|
||||||
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
||||||
m.Group("/{id}", func() {
|
m.Group("/{id}", func() {
|
||||||
m.Get("", repo_setting.WebHooksEdit)
|
m.Get("", repo_setting.WebhookEdit)
|
||||||
m.Post("", repo_setting.WebhookUpdate)
|
m.Post("", repo_setting.WebhookUpdate)
|
||||||
m.Post("/test", repo_setting.TestWebhook)
|
m.Post("/test", repo_setting.WebhookTest)
|
||||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||||
})
|
})
|
||||||
}, webhooksEnabled)
|
}, webhooksEnabled)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue