-
Notifications
You must be signed in to change notification settings - Fork 937
refactor: Add roles into the user response #1347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frontend looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one tiny change!
Codecov Report
@@ Coverage Diff @@
## main #1347 +/- ##
==========================================
- Coverage 66.44% 66.43% -0.02%
==========================================
Files 284 280 -4
Lines 18584 18393 -191
Branches 235 235
==========================================
- Hits 12349 12219 -130
+ Misses 4967 4923 -44
+ Partials 1268 1251 -17
Continue to review full report at Codecov.
|
Interesting to see the JS tests failing because an API change 👏 |
coderd/roles.go
Outdated
} | ||
} | ||
|
||
func ConvertRoles(roles []rbac.Role) []codersdk.Role { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be exported either!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using it for some tests here
Line 88 in 87c474b
ExpectedRoles: coderd.ConvertRoles(rbac.OrganizationRoles(admin.OrganizationID)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never need to use internal coderd
APIs to check API responses, otherwise, our customers will have to as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking on:
- Do not export the convert functions
- Copy the convert functions into the role tests
- See if we need restructure the tests at all
Since the roles are already returned by the User model, we just need to parse it from a rbac.Role to codersdk.Role.
Closes #1346