Skip to content

Commit

Permalink
Update some Notification functions to return nil slice instead of nil
Browse files Browse the repository at this point in the history
  • Loading branch information
arybolovlev authored and jrhouston committed Mar 27, 2023
1 parent 75cb970 commit d53d81b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/workspace_controller_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ func (r *WorkspaceReconciler) getOrgMembers(ctx context.Context, w *workspaceIns

func (r *WorkspaceReconciler) getInstanceNotifications(ctx context.Context, w *workspaceInstance) ([]tfc.NotificationConfiguration, error) {
if len(w.instance.Spec.Notifications) == 0 {
return nil, nil
return []tfc.NotificationConfiguration{}, nil
}

o := make([]tfc.NotificationConfiguration, len(w.instance.Spec.Notifications))

orgEmailUsers, err := r.getOrgMembers(ctx, w)
if err != nil {
return nil, err
return []tfc.NotificationConfiguration{}, err
}

o := make([]tfc.NotificationConfiguration, len(w.instance.Spec.Notifications))

for i, n := range w.instance.Spec.Notifications {
var eu []*tfc.User
for _, e := range n.EmailUsers {
Expand Down Expand Up @@ -105,7 +105,7 @@ func (r *WorkspaceReconciler) getInstanceNotifications(ctx context.Context, w *w
func (r *WorkspaceReconciler) getWorkspaceNotifications(ctx context.Context, w *workspaceInstance) ([]tfc.NotificationConfiguration, error) {
wn, err := w.tfClient.Client.NotificationConfigurations.List(ctx, w.instance.Status.WorkspaceID, &tfc.NotificationConfigurationListOptions{})
if err != nil {
return nil, err
return []tfc.NotificationConfiguration{}, err
}

o := make([]tfc.NotificationConfiguration, len(wn.Items))
Expand Down

0 comments on commit d53d81b

Please sign in to comment.