Skip to content

Commit

Permalink
Merge pull request #46 from iLert/fix/alert-action-conditions-field
Browse files Browse the repository at this point in the history
Fix/alert action conditions field
  • Loading branch information
STLVRTX authored Oct 1, 2024
2 parents ee069e0 + a635e63 commit 0a56cb6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 01.10.2024, Version 3.10.1

- fix to ensure backwards compatibility when using conditions field [#46](https://github.com/iLert/ilert-go/pull/46)

## 01.10.2024, Version 3.10.0

- add conditions field to alert action [#45](https://github.com/iLert/ilert-go/pull/45)
Expand Down
4 changes: 2 additions & 2 deletions alert_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (c *Client) CreateAlertAction(input *CreateAlertActionInput) (*CreateAlertA
if input.AlertAction == nil {
return nil, errors.New("alert action input is required")
}
if input.AlertAction.AlertSources != nil && len(*input.AlertAction.AlertSources) == 1 && (input.AlertAction.Teams == nil || len(*input.AlertAction.Teams) == 0) {
if input.AlertAction.AlertSources != nil && len(*input.AlertAction.AlertSources) == 1 && (input.AlertAction.Teams == nil || len(*input.AlertAction.Teams) == 0) && input.AlertAction.Conditions == "" {
sourceId := (*input.AlertAction.AlertSources)[0].ID

// manually set fields to ensure backwards compatibility with api v1
Expand Down Expand Up @@ -576,7 +576,7 @@ func (c *Client) UpdateAlertAction(input *UpdateAlertActionInput) (*UpdateAlertA
if input.AlertActionID == nil {
return nil, errors.New("alert action id is required")
}
if input.AlertAction.AlertSources != nil && len(*input.AlertAction.AlertSources) == 1 && (input.AlertAction.Teams == nil || len(*input.AlertAction.Teams) == 0) {
if input.AlertAction.AlertSources != nil && len(*input.AlertAction.AlertSources) == 1 && (input.AlertAction.Teams == nil || len(*input.AlertAction.Teams) == 0) && input.AlertAction.Conditions == "" {
sourceId := (*input.AlertAction.AlertSources)[0].ID

// manually set fields to ensure backwards compatibility with api v1
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ilert

// Version package version
const Version = "v3.10.0"
const Version = "v3.10.1"

0 comments on commit 0a56cb6

Please sign in to comment.