mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-02 15:10:43 +02:00
Refactor webhook events (#33337)
Extract from #33320 This PR uses a map instead of a struct to store webhook event information. It removes many duplicated functions and makes the logic clearer.
This commit is contained in:
1 parent
594b8350b1
commit
e94f37f95e
10 files changed
+176
-335
No files matched your search
@@ -137,14 +137,8 @@ func PrepareWebhook(ctx context.Context, w *webhook_model.Webhook, event webhook
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, e := range w.EventCheckers() {
|
||||
if event == e.Type {
|
||||
if !e.Has() {
|
||||
return nil
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
if !w.HasEvent(event) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Avoid sending "0 new commits" to non-integration relevant webhooks (e.g. slack, discord, etc.).
|
||||
|
||||
Reference in new issue
Block a user