forked from forgejo/forgejo
[REFACTOR] webhook.Handler interface
This commit is contained in:
parent
142459bbe0
commit
702152bfde
35 changed files with 378 additions and 210 deletions
|
@ -637,17 +637,9 @@ func checkWebhook(ctx *context.Context) (*ownerRepoCtx, *webhook.Webhook) {
|
|||
}
|
||||
|
||||
ctx.Data["HookType"] = w.Type
|
||||
switch w.Type {
|
||||
case webhook_module.SLACK:
|
||||
ctx.Data["SlackHook"] = webhook_service.GetSlackHook(w)
|
||||
case webhook_module.DISCORD:
|
||||
ctx.Data["DiscordHook"] = webhook_service.GetDiscordHook(w)
|
||||
case webhook_module.TELEGRAM:
|
||||
ctx.Data["TelegramHook"] = webhook_service.GetTelegramHook(w)
|
||||
case webhook_module.MATRIX:
|
||||
ctx.Data["MatrixHook"] = webhook_service.GetMatrixHook(w)
|
||||
case webhook_module.PACKAGIST:
|
||||
ctx.Data["PackagistHook"] = webhook_service.GetPackagistHook(w)
|
||||
|
||||
if handler := webhook_service.GetWebhookHandler(w.Type); handler != nil {
|
||||
ctx.Data["HookMetadata"] = handler.Metadata(w)
|
||||
}
|
||||
|
||||
ctx.Data["History"], err = w.History(ctx, 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue