Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions internal/workflows/tasks/providers/thand/approvals.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package thand
import (
"errors"
"fmt"
"maps"
"slices"
"time"

cloudevents "github.com/cloudevents/sdk-go/v2"
Expand Down Expand Up @@ -434,7 +436,8 @@ func (t *thandTask) makeApprovalNotifications(
// In parallel create a notifier for each of the notifiers
// Build notification tasks for each provider
var notifyTasks []notifyTask
for providerKey, notifierRequest := range approvalsTask.Notifiers {
for _, providerKey := range slices.Sorted(maps.Keys(approvalsTask.Notifiers)) {
notifierRequest := approvalsTask.Notifiers[providerKey]
// Create an ApprovalNotifier for each provider
approvalNotifier := NewApprovalsNotifier(
t.config,
Expand Down Expand Up @@ -546,7 +549,8 @@ func (t *thandTask) notifyApprovalRejection(
}

// Send rejection notification using each configured notifier
for providerKey, notifierRequest := range approvalsTask.Notifiers {
for _, providerKey := range slices.Sorted(maps.Keys(approvalsTask.Notifiers)) {
notifierRequest := approvalsTask.Notifiers[providerKey]
// Create a generic notifier for rejection with the approver as recipient
rejectionRequest := thandFunction.NotifierRequest{
Provider: notifierRequest.Provider,
Expand Down
5 changes: 4 additions & 1 deletion internal/workflows/tasks/providers/thand/authorize.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package thand
import (
"errors"
"fmt"
"maps"
"net/http"
"slices"
"sync"
"time"

Expand Down Expand Up @@ -556,7 +558,8 @@ func (t *thandTask) makeAuthorizationNotifications(

// Build notification tasks for each provider
var notifyTasks []notifyTask
for providerKey, notifierRequest := range authorizeTask.Notifiers {
for _, providerKey := range slices.Sorted(maps.Keys(authorizeTask.Notifiers)) {
notifierRequest := authorizeTask.Notifiers[providerKey]
// Create an AuthorizerNotifier for each provider
authorizeNotifier := NewAuthorizerNotifier(
t.config,
Expand Down
5 changes: 4 additions & 1 deletion internal/workflows/tasks/providers/thand/form.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"errors"
"fmt"
"maps"
"slices"

cloudevents "github.com/cloudevents/sdk-go/v2"
"github.com/serverlessworkflow/sdk-go/v3/model"
Expand Down Expand Up @@ -248,7 +250,8 @@ func (t *thandTask) makeFormNotifications(

var notifyTasks []notifyTask

for providerKey, notifierRequest := range formTask.Notifiers {
for _, providerKey := range slices.Sorted(maps.Keys(formTask.Notifiers)) {
notifierRequest := formTask.Notifiers[providerKey]
// Create a FormNotifier for each provider
formNotifier := NewFormNotifier(
t.config,
Expand Down
5 changes: 4 additions & 1 deletion internal/workflows/tasks/providers/thand/revoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package thand
import (
"errors"
"fmt"
"maps"
"slices"
"sync"
"time"

Expand Down Expand Up @@ -365,7 +367,8 @@ func (t *thandTask) makeRevocationNotifications(

// Build notification tasks for each provider
var notifyTasks []notifyTask
for providerKey, notifierRequest := range revokeTask.Notifiers {
for _, providerKey := range slices.Sorted(maps.Keys(revokeTask.Notifiers)) {
notifierRequest := revokeTask.Notifiers[providerKey]
// Create a RevokeNotifier for each provider
revokeNotifier := NewRevokeNotifier(
t.config,
Expand Down
Loading