Skip to content

Commit

Permalink
fix: appropriately pass context around (ory#2241)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Feb 21, 2022
1 parent bda2896 commit 60eb721
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/hashers/argon2/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func configProvider(cmd *cobra.Command, flagConf *argon2Config) (*argon2Config,
conf := &argon2Config{}
var err error
conf.config, err = config.New(
context.Background(),
cmd.Context(),
l,
cmd.ErrOrStderr(),
configx.WithFlags(cmd.Flags()),
Expand Down
2 changes: 1 addition & 1 deletion selfservice/flow/settings/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (s *ErrorHandler) WriteFlowError(
return
}

if err := sortNodes(f.UI.Nodes, schema.RawURL); err != nil {
if err := sortNodes(r.Context(), f.UI.Nodes, schema.RawURL); err != nil {
s.forward(w, r, f, err)
return
}
Expand Down
2 changes: 1 addition & 1 deletion selfservice/flow/settings/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (h *Handler) NewFlow(w http.ResponseWriter, r *http.Request, i *identity.Id
return nil, err
}

if err := sortNodes(f.UI.Nodes, ds.String()); err != nil {
if err := sortNodes(r.Context(), f.UI.Nodes, ds.String()); err != nil {
return nil, err
}

Expand Down
4 changes: 1 addition & 3 deletions selfservice/flow/settings/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import (
"github.com/ory/kratos/ui/node"
)

var ctx = context.Background()

func sortNodes(n node.Nodes, schemaRef string) error {
func sortNodes(ctx context.Context, n node.Nodes, schemaRef string) error {
return n.SortBySchema(ctx,
node.SortBySchema(schemaRef),
node.SortByGroups([]node.Group{
Expand Down
6 changes: 4 additions & 2 deletions selfservice/flow/settings/strategy_helper_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package settings

import (
"testing"

"github.com/stretchr/testify/require"

"github.com/ory/kratos/identity"
"github.com/ory/kratos/x"
"github.com/stretchr/testify/require"
"testing"
)

func TestGetIdentityToUpdate(t *testing.T) {
Expand Down

0 comments on commit 60eb721

Please sign in to comment.