Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 17 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,7 @@ package thand
import (
"errors"
"fmt"
"sort"
"time"

cloudevents "github.com/cloudevents/sdk-go/v2"
Expand Down Expand Up @@ -434,7 +435,14 @@ 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 {
providerKeys := make([]string, 0, len(approvalsTask.Notifiers))
for providerKey := range approvalsTask.Notifiers {
providerKeys = append(providerKeys, providerKey)
}
sort.Strings(providerKeys)

Comment thread
hughneale marked this conversation as resolved.
Outdated
for _, providerKey := range providerKeys {
Comment thread
hughneale marked this conversation as resolved.
Outdated
notifierRequest := approvalsTask.Notifiers[providerKey]
// Create an ApprovalNotifier for each provider
approvalNotifier := NewApprovalsNotifier(
t.config,
Expand Down Expand Up @@ -546,7 +554,14 @@ func (t *thandTask) notifyApprovalRejection(
}

// Send rejection notification using each configured notifier
for providerKey, notifierRequest := range approvalsTask.Notifiers {
providerKeys := make([]string, 0, len(approvalsTask.Notifiers))
for providerKey := range approvalsTask.Notifiers {
providerKeys = append(providerKeys, providerKey)
}
sort.Strings(providerKeys)

for _, providerKey := range providerKeys {
notifierRequest := approvalsTask.Notifiers[providerKey]
// Create a generic notifier for rejection with the approver as recipient
rejectionRequest := thandFunction.NotifierRequest{
Provider: notifierRequest.Provider,
Expand Down
10 changes: 9 additions & 1 deletion internal/workflows/tasks/providers/thand/authorize.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net/http"
"sort"
"sync"
"time"

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

// Build notification tasks for each provider
var notifyTasks []notifyTask
for providerKey, notifierRequest := range authorizeTask.Notifiers {
providerKeys := make([]string, 0, len(authorizeTask.Notifiers))
for providerKey := range authorizeTask.Notifiers {
providerKeys = append(providerKeys, providerKey)
}
sort.Strings(providerKeys)

for _, providerKey := range providerKeys {
notifierRequest := authorizeTask.Notifiers[providerKey]
// Create an AuthorizerNotifier for each provider
authorizeNotifier := NewAuthorizerNotifier(
t.config,
Expand Down
10 changes: 9 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,7 @@ import (
"encoding/json"
"errors"
"fmt"
"sort"

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

var notifyTasks []notifyTask

for providerKey, notifierRequest := range formTask.Notifiers {
providerKeys := make([]string, 0, len(formTask.Notifiers))
for providerKey := range formTask.Notifiers {
providerKeys = append(providerKeys, providerKey)
}
sort.Strings(providerKeys)

for _, providerKey := range providerKeys {
notifierRequest := formTask.Notifiers[providerKey]
// Create a FormNotifier for each provider
formNotifier := NewFormNotifier(
t.config,
Expand Down
10 changes: 9 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,7 @@ package thand
import (
"errors"
"fmt"
"sort"
"sync"
"time"

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

// Build notification tasks for each provider
var notifyTasks []notifyTask
for providerKey, notifierRequest := range revokeTask.Notifiers {
providerKeys := make([]string, 0, len(revokeTask.Notifiers))
for providerKey := range revokeTask.Notifiers {
providerKeys = append(providerKeys, providerKey)
}
sort.Strings(providerKeys)

for _, providerKey := range providerKeys {
notifierRequest := revokeTask.Notifiers[providerKey]
// Create a RevokeNotifier for each provider
revokeNotifier := NewRevokeNotifier(
t.config,
Expand Down
Loading