Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add reset user password action #1320

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

Merged
merged 18 commits into from
May 6, 2022
Merged

Conversation

BrunoQuaresma
Copy link
Collaborator

Closes #733

@BrunoQuaresma BrunoQuaresma self-assigned this May 6, 2022
@BrunoQuaresma BrunoQuaresma requested review from presleyp and a team as code owners May 6, 2022 15:07
@codecov
Copy link

codecov bot commented May 6, 2022

Codecov Report

Merging #1320 (e388f8a) into main (57bb108) will increase coverage by 8.39%.
The diff coverage is 85.71%.

@@            Coverage Diff             @@
##             main    #1320      +/-   ##
==========================================
+ Coverage   58.09%   66.48%   +8.39%     
==========================================
  Files         282      284       +2     
  Lines       18521    18569      +48     
  Branches      231      235       +4     
==========================================
+ Hits        10759    12345    +1586     
+ Misses       6601     4959    -1642     
- Partials     1161     1265     +104     
Flag Coverage Δ
unittest-go-macos-latest 53.64% <100.00%> (-0.04%) ⬇️
unittest-go-postgres- 65.07% <100.00%> (?)
unittest-go-ubuntu-latest 56.07% <100.00%> (+0.01%) ⬆️
unittest-go-windows-2022 52.05% <100.00%> (+0.03%) ⬆️
unittest-js 73.67% <84.61%> (+0.52%) ⬆️
Impacted Files Coverage Δ
site/src/api/index.ts 71.23% <50.00%> (-0.60%) ⬇️
site/src/pages/UsersPage/UsersPageView.tsx 93.33% <50.00%> (+0.47%) ⬆️
site/src/pages/UsersPage/UsersPage.tsx 75.86% <66.66%> (-3.31%) ⬇️
site/src/xServices/users/usersXService.ts 75.00% <66.66%> (-4.17%) ⬇️
coderd/users.go 61.36% <100.00%> (ø)
site/src/components/CodeBlock/CodeBlock.tsx 100.00% <100.00%> (ø)
...onents/ResetPasswordDialog/ResetPasswordDialog.tsx 100.00% <100.00%> (ø)
site/src/components/UsersTable/UsersTable.tsx 100.00% <100.00%> (ø)
site/src/util/random.ts 100.00% <100.00%> (ø)
codersdk/provisionerdaemons.go 61.97% <0.00%> (-5.64%) ⬇️
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57bb108...e388f8a. Read the comment docs.


export const Language = {
createUserSuccess: "Successfully created user.",
suspendUserSuccess: "Successfully suspended the user.",
suspendUserError: "Error on suspend the user",
suspendUserError: "Error on suspend the user.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch

| { type: "SUSPEND_USER"; userId: TypesGen.User["id"] }
| { type: "CONFIRM_USER_SUSPENSION" }
| { type: "CANCEL_USER_SUSPENSION" }
// Reset password events
| { type: "RESET_USER_PASSWORD"; userId: TypesGen.User["id"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how you use TypesGen.User["id"], we should do that more

const navigate = useNavigate()
const userToBeSuspended = users?.find((u) => u.id === userIdToSuspend)
const userToResetPassword = users?.find((u) => u.id === userIdToResetPassword)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future we may want to find a way to make the XService give the component the user instead of the user id, but this is fine for now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've been wondering about that, instead of passing a userId, we could just send the full user object to make things easier but it makes it hard to sync, if we need it, in case the same user is updated by any other action. Using the ID we keep the reference to the user in the list which is always updated since it is the source of the truth. Makes sense?

Copy link
Contributor

@presleyp presleyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@misskniss misskniss added this to the V2 Beta milestone May 15, 2022
kylecarbs pushed a commit that referenced this pull request Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Frontend User Update - Reset Password
3 participants