mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-05 09:55:20 +02: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:
parent
f8e93ce423
commit
0f4e1b9ac6
37 changed files with 444 additions and 362 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue