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

[CORL-2805]: Delete user button in admin #4481

Merged
merged 17 commits into from
Jan 23, 2024

Conversation

kabeaty
Copy link
Contributor

@kabeaty kabeaty commented Jan 11, 2024

What does this PR do?

These changes add a button to the user account history drawer to be able to delete a user's account if you are an admin. You can also cancel the deletion request there if one has already been made. The history of account deletion requests and cancellations is also now displayed in the user account history drawer.

These changes will impact:

  • commenters
  • moderators
  • admins
  • developers

What changes to the GraphQL/Database Schema does this PR introduce?

These changes add user deletion history to a user's status history to keep track of requests and cancellations for deletion. The changes also add mutations for scheduling deletions and cancelling deletions to be used by admin users other than the target user.

Does this PR introduce any new environment variables or feature flags?

no

If any indexes were added, were they added to INDEXES.md?

n/a

How do I test this PR?

You can test this PR by logging in as an admin user and clicking on another user's username in the Community tab of the admin to open that user's account history drawer. Then click Account History. You should see a button at the top that says Delete Account. When you click it, you will see that it now says the account has been scheduled for deletion along with when and the option to cancel it. You should also see this deletion request at the top of the account history with the username of the user who you used to request it. Click Cancel User Deletion button. See that the request is canceled, with the deletion cancellation request shown at the top of the account history and the Delete Account button shown again.

If there is an error when scheduling the account deletion, its message will be displayed in the account deletion popover. If there is an error canceling the account deletion, it will be displayed in account history near the cancel deletion callout. You can also test these if you like.

You can also confirm that:

  • only admins can see the button when logged into the admin
  • if a user requests their own deletion via My profile -> Account, the deletion history is updated and shown in the user account history drawer in the admin accordingly
  • once the deletion time has passed after an admin-requested deletion is scheduled, as with a user-scheduled deletion, the user is deleted

Were any tests migrated to React Testing Library?

How do we deploy this PR?

Copy link

netlify bot commented Jan 11, 2024

Deploy Preview for gallant-galileo-14878c canceled.

Name Link
🔨 Latest commit 97d845a
🔍 Latest deploy log https://app.netlify.com/sites/gallant-galileo-14878c/deploys/65b00bdcf29c66000884d480

@kabeaty kabeaty requested a review from nick-funk January 11, 2024 15:30
Copy link
Contributor

@nick-funk nick-funk left a comment

Choose a reason for hiding this comment

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

Looks good, made a couple comments about some resolver return types that might be worth looking into.

};

export const UserDeletionStatus: Required<
GQLUserDeletionStatusTypeResolver<UserDeletionStatusInput>
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we using an input as a resolver result type here? Maybe time for a new interface or maybe there is a generated schema type that would make more sense?

@@ -57,6 +58,10 @@ export const UserStatus: Required<GQLUserStatusTypeResolver<UserStatusInput>> =
...user.consolidateUsernameStatus(username),
userID,
}),
deletion: ({ userID, deletion }): UserDeletionStatusInput => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, seems like the resolver might have generated a result type instead of an Input.

@kabeaty kabeaty added this pull request to the merge queue Jan 23, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jan 23, 2024
@kabeaty kabeaty enabled auto-merge January 23, 2024 18:56
@kabeaty kabeaty added this pull request to the merge queue Jan 23, 2024
Merged via the queue into develop with commit 8f54ea2 Jan 23, 2024
6 checks passed
@kabeaty kabeaty deleted the feat/CORL-2805-delete-user-button-admin branch January 23, 2024 19:37
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.

2 participants