Skip to content

Commit

Permalink
fix: properly pass context (#2300)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Mar 11, 2022
1 parent 47eaae5 commit fab8a93
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion selfservice/flow/login/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (s *ErrorHandler) WriteFlowError(w http.ResponseWriter, r *http.Request, f
return
}

if err := sortNodes(f.UI.Nodes); err != nil {
if err := sortNodes(r.Context(), f.UI.Nodes); err != nil {
s.forward(w, r, f, err)
return
}
Expand Down
4 changes: 2 additions & 2 deletions selfservice/flow/login/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ preLoginHook:
}
}

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

Expand Down Expand Up @@ -588,7 +588,7 @@ continueLogin:
sess = session.NewInactiveSession()
}

method := ss.CompletedAuthenticationMethod(ctx)
method := ss.CompletedAuthenticationMethod(r.Context())
sess.CompletedLoginFor(method.Method, method.AAL)
i = interim
break
Expand Down
4 changes: 1 addition & 3 deletions selfservice/flow/login/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) error {
func sortNodes(ctx context.Context, n node.Nodes) error {
return n.SortBySchema(ctx,
node.SortByGroups([]node.Group{
node.OpenIDConnectGroup,
Expand Down
3 changes: 1 addition & 2 deletions ui/container/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ func newFormRequest(t *testing.T, values url.Values) *http.Request {
return req
}

var ctx = context.Background()

func TestContainer(t *testing.T) {
var ctx = context.Background()
t.Run("method=NewFromJSON", func(t *testing.T) {
for k, tc := range []struct {
r string
Expand Down
4 changes: 2 additions & 2 deletions ui/node/attributes_input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/ory/x/jsonschemax"
)

var ctx = context.Background()

func TestFieldFromPath(t *testing.T) {

var ctx = context.Background()
t.Run("all properties are properly transferred", func(t *testing.T) {
schema, err := ioutil.ReadFile("./fixtures/all_formats.schema.json")
require.NoError(t, err)
Expand Down

0 comments on commit fab8a93

Please sign in to comment.