mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Restructure webhook
module (#22256)
Previously, there was an `import services/webhooks` inside `modules/notification/webhook`. This import was removed (after fighting against many import cycles). Additionally, `modules/notification/webhook` was moved to `modules/webhook`, and a few structs/constants were extracted from `models/webhooks` to `modules/webhook`. Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
@ -26,6 +26,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/proxy"
|
||||
"code.gitea.io/gitea/modules/queue"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
webhook_module "code.gitea.io/gitea/modules/webhook"
|
||||
|
||||
"github.com/gobwas/glob"
|
||||
)
|
||||
@ -89,7 +90,7 @@ func Deliver(ctx context.Context, t *webhook_model.HookTask) error {
|
||||
}
|
||||
case http.MethodPut:
|
||||
switch w.Type {
|
||||
case webhook_model.MATRIX:
|
||||
case webhook_module.MATRIX:
|
||||
txnID, err := getMatrixTxnID([]byte(t.PayloadContent))
|
||||
if err != nil {
|
||||
return err
|
||||
@ -189,9 +190,9 @@ func Deliver(ctx context.Context, t *webhook_model.HookTask) error {
|
||||
|
||||
// Update webhook last delivery status.
|
||||
if t.IsSucceed {
|
||||
w.LastStatus = webhook_model.HookStatusSucceed
|
||||
w.LastStatus = webhook_module.HookStatusSucceed
|
||||
} else {
|
||||
w.LastStatus = webhook_model.HookStatusFail
|
||||
w.LastStatus = webhook_module.HookStatusFail
|
||||
}
|
||||
if err = webhook_model.UpdateWebhookLastStatus(w); err != nil {
|
||||
log.Error("UpdateWebhookLastStatus: %v", err)
|
||||
|
Reference in New Issue
Block a user