fix(webhooks): fix HasEvent logic

* fix premature return in the check which skips all following events when the first one was false
* add test cases

Closes: #1354
This commit is contained in:
Stefan Jacobi
2024-02-19 10:55:14 +01:00
parent cfd11cd194
commit ae7bae5091
2 changed files with 23 additions and 1 deletions

View File

@ -34,7 +34,9 @@ type BaseWebhook struct {
func (bh *BaseWebhook) HasEvent(evt events.Event) bool {
for _, event := range bh.Events {
return strings.HasPrefix(string(evt), string(event))
if strings.HasPrefix(string(evt), string(event)) {
return true
}
}
return false