Skip to content

Commit

Permalink
revert SearchUser
Browse files Browse the repository at this point in the history
  • Loading branch information
hexaforce committed Nov 21, 2024
1 parent 7eed562 commit 64bd388
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/internal/adapter/gql/loader_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gql

import (
"context"
"errors"

"github.com/reearth/reearth/server/internal/adapter/gql/gqldataloader"
"github.com/reearth/reearth/server/internal/adapter/gql/gqlmodel"
Expand Down Expand Up @@ -43,7 +44,13 @@ func (c *UserLoader) SearchUser(ctx context.Context, nameOrEmail string) (*gqlmo
return nil, err
}

return gqlmodel.ToUserFromSimple(res), nil
for _, user := range res {
if user.Name == nameOrEmail || user.Email == nameOrEmail {
return gqlmodel.ToUserFromSimple(user), nil
}
}

return nil, errors.New("user not found.")
}

// data loader
Expand Down

0 comments on commit 64bd388

Please sign in to comment.