Skip to content

Commit

Permalink
fix: appropriately pass context around
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Feb 21, 2022
1 parent 506a0f1 commit 6cca807
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 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
5 changes: 1 addition & 4 deletions selfservice/flow/settings/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ package settings

import (
"context"

"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

0 comments on commit 6cca807

Please sign in to comment.