Skip to content

Commit

Permalink
Allowing only alert trigger type to have empty configuration (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
g4ndr4 authored Mar 13, 2024
1 parent fe1cb3d commit 2118ed4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions model/actions/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ func (a Trigger) Validate(ctx ValidatorContext) (response ValidateResponse) {
return response.Error(ctx, MsgTriggerTypeNotSupported, a.Type, TriggerTypes)
}

// This handles just type
if a.Periodic == nil && a.Webhook == nil && a.Block == nil && a.Transaction == nil && a.Alert == nil {
return response
}

switch a.Type {
case PeriodicType:
if a.Periodic == nil {
Expand All @@ -58,7 +53,7 @@ func (a Trigger) Validate(ctx ValidatorContext) (response ValidateResponse) {
return response.Merge(a.Transaction.Validate(ctx.With(a.Type)))
case AlertType:
if a.Alert == nil {
return response.Error(ctx, MsgTriggerTypeMismatch, a.Type)
return response
}
return response.Merge(a.Alert.Validate(ctx.With(a.Type)))
}
Expand Down

0 comments on commit 2118ed4

Please sign in to comment.