mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 14:13:52 +03:00
[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"
|
||||
)
|
||||
|
||||
// Webhooks render web hooks list page
|
||||
func Webhooks(ctx *context.Context) {
|
||||
// WebhookList render web hooks list page
|
||||
func WebhookList(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
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")
|
||||
}
|
||||
|
||||
// WebhooksNew render creating webhook page
|
||||
func WebhooksNew(ctx *context.Context) {
|
||||
// WebhookNew render creating webhook page
|
||||
func WebhookNew(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||
ctx.Data["Webhook"] = webhook.Webhook{HookEvent: &webhook_module.HookEvent{}}
|
||||
|
||||
|
@ -367,8 +367,8 @@ func checkWebhook(ctx *context.Context) (*ownerRepoCtx, *webhook.Webhook) {
|
|||
return orCtx, w
|
||||
}
|
||||
|
||||
// WebHooksEdit render editing web hook page
|
||||
func WebHooksEdit(ctx *context.Context) {
|
||||
// WebhookEdit render editing web hook page
|
||||
func WebhookEdit(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
|
@ -382,8 +382,8 @@ func WebHooksEdit(ctx *context.Context) {
|
|||
ctx.HTML(http.StatusOK, orCtx.NewTemplate)
|
||||
}
|
||||
|
||||
// TestWebhook test if web hook is work fine
|
||||
func TestWebhook(ctx *context.Context) {
|
||||
// WebhookTest test if web hook is work fine
|
||||
func WebhookTest(ctx *context.Context) {
|
||||
hookID := ctx.ParamsInt64(":id")
|
||||
w, err := webhook.GetWebhookByRepoID(ctx, ctx.Repo.Repository.ID, hookID)
|
||||
if err != nil {
|
||||
|
@ -443,8 +443,8 @@ func TestWebhook(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
// ReplayWebhook replays a webhook
|
||||
func ReplayWebhook(ctx *context.Context) {
|
||||
// WebhookReplay replays a webhook
|
||||
func WebhookReplay(ctx *context.Context) {
|
||||
hookTaskUUID := ctx.Params(":uuid")
|
||||
|
||||
orCtx, w := checkWebhook(ctx)
|
||||
|
@ -465,8 +465,8 @@ func ReplayWebhook(ctx *context.Context) {
|
|||
ctx.Redirect(fmt.Sprintf("%s/%d", orCtx.Link, w.ID))
|
||||
}
|
||||
|
||||
// DeleteWebhook delete a webhook
|
||||
func DeleteWebhook(ctx *context.Context) {
|
||||
// WebhookDelete delete a webhook
|
||||
func WebhookDelete(ctx *context.Context) {
|
||||
if err := webhook.DeleteWebhookByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormInt64("id")); err != nil {
|
||||
ctx.Flash.Error("DeleteWebhookByRepoID: " + err.Error())
|
||||
} else {
|
||||
|
|
|
@ -609,12 +609,12 @@ func registerRoutes(m *web.Route) {
|
|||
m.Group("/hooks", func() {
|
||||
m.Get("", user_setting.Webhooks)
|
||||
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.Group("/{id}", func() {
|
||||
m.Get("", repo_setting.WebHooksEdit)
|
||||
m.Get("", repo_setting.WebhookEdit)
|
||||
m.Post("", repo_setting.WebhookUpdate)
|
||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
||||
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||
})
|
||||
}, webhooksEnabled)
|
||||
|
||||
|
@ -714,14 +714,14 @@ func registerRoutes(m *web.Route) {
|
|||
m.Get("", admin.DefaultOrSystemWebhooks)
|
||||
m.Post("/delete", admin.DeleteDefaultOrSystemWebhook)
|
||||
m.Group("/{id}", func() {
|
||||
m.Get("", repo_setting.WebHooksEdit)
|
||||
m.Get("", repo_setting.WebhookEdit)
|
||||
m.Post("", repo_setting.WebhookUpdate)
|
||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
||||
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||
})
|
||||
}, webhooksEnabled)
|
||||
|
||||
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)
|
||||
})
|
||||
|
||||
|
@ -880,12 +880,12 @@ func registerRoutes(m *web.Route) {
|
|||
m.Group("/hooks", func() {
|
||||
m.Get("", org.Webhooks)
|
||||
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.Group("/{id}", func() {
|
||||
m.Get("", repo_setting.WebHooksEdit)
|
||||
m.Get("", repo_setting.WebhookEdit)
|
||||
m.Post("", repo_setting.WebhookUpdate)
|
||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
||||
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||
})
|
||||
}, webhooksEnabled)
|
||||
|
||||
|
@ -1053,15 +1053,15 @@ func registerRoutes(m *web.Route) {
|
|||
}, context.GitHookService())
|
||||
|
||||
m.Group("/hooks", func() {
|
||||
m.Get("", repo_setting.Webhooks)
|
||||
m.Post("/delete", repo_setting.DeleteWebhook)
|
||||
m.Get("/{type}/new", repo_setting.WebhooksNew)
|
||||
m.Get("", repo_setting.WebhookList)
|
||||
m.Post("/delete", repo_setting.WebhookDelete)
|
||||
m.Get("/{type}/new", repo_setting.WebhookNew)
|
||||
m.Post("/{type}/new", repo_setting.WebhookCreate)
|
||||
m.Group("/{id}", func() {
|
||||
m.Get("", repo_setting.WebHooksEdit)
|
||||
m.Get("", repo_setting.WebhookEdit)
|
||||
m.Post("", repo_setting.WebhookUpdate)
|
||||
m.Post("/test", repo_setting.TestWebhook)
|
||||
m.Post("/replay/{uuid}", repo_setting.ReplayWebhook)
|
||||
m.Post("/test", repo_setting.WebhookTest)
|
||||
m.Post("/replay/{uuid}", repo_setting.WebhookReplay)
|
||||
})
|
||||
}, webhooksEnabled)
|
||||
|
||||
|
|
Loading…
Reference in a new issue