Skip to content
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

Add user deactivation functionality #607

Merged
merged 3 commits into from
Apr 13, 2023
Merged

Conversation

Myrfion
Copy link
Contributor

@Myrfion Myrfion commented Apr 12, 2023

  • add intent field for each action on admin screen, to manage them properly
  • add function for user deletion, which deletes user from db and triggers reconcile
  • integrate functionality with the front end
Screen.Recording.2023-04-12.at.19.05.01.mov

Closes #308

@Myrfion Myrfion added category: back end Back end part of our web service area: web Web development related things [front end/back end] labels Apr 12, 2023
@Myrfion Myrfion requested review from humphd, Eakam1007, sfrunza13, cychu42 and a user April 12, 2023 23:13
@Myrfion Myrfion self-assigned this Apr 12, 2023
sfrunza13
sfrunza13 previously approved these changes Apr 12, 2023
@sfrunza13
Copy link
Contributor

sfrunza13 commented Apr 12, 2023

When I originally wrote the admin thing I tried expanding the ZOD schema and it failed, I made effective username optional so I was stumped at the time as to why it would not work, I am now realizing I forgot to make the search string optional! Since they are mutually exclusive basically it never worked for me lol.

Edit: This is nicer, good work

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

This is great. A few small things.

/>
</Tooltip>
<Form method="post" reloadDocument>
<Tooltip label="Deactivate user">
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd use Delete vs. Deactivate everywhere, since we're really dropping the user from the db.


export async function deleteUser(username: User['username']) {
await deleteUserByUsername(username);
setIsReconciliationNeeded(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

return here, so the Promise is returned"

return setIsReconciliationNeeded(true);

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing this, what if we add setIsReconciliationNeeded(true); inside deleteUserByUsername and just use it?

@Genne23v
Copy link
Contributor

How about add a pop-up to reduce chances of mistake by admin?

@humphd
Copy link
Contributor

humphd commented Apr 13, 2023

How about add a pop-up to reduce chances of mistake by admin?

You mean like we do for deleting DNS records? That's a great idea. It could be filed/done as a follow-up.

@@ -4,5 +4,5 @@ import { deleteUserByUsername } from '~/models/user.server';

export async function deleteUser(username: User['username']) {
await deleteUserByUsername(username);
setIsReconciliationNeeded(true);
return setIsReconciliationNeeded(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

We could do a follow-up to audit all callers of setIsReconciliationNeeded(true) to see if we can move them into the model methods per @cychu42's comment, if you don't want to do it here.

@Myrfion Myrfion merged commit d8e1d3d into main Apr 13, 2023
@Myrfion Myrfion deleted the feature/user-reactivation branch April 13, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: web Web development related things [front end/back end] category: back end Back end part of our web service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to be deactivated
5 participants