-
Notifications
You must be signed in to change notification settings - Fork 333
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
feat: implement deleteUsers
mutation
#10498
base: master
Are you sure you want to change the base?
Conversation
deleteUsers
mutations
deleteUsers
mutationsdeleteUsers
mutation
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.
I think this would work, but I'm a bit skeptical if it's the correct approach. If I'm a contractor at Contractors United and join Megacorp for a job, I don't want them to be able to delete my whole account just because they have admin rights there.
@@ -2,5 +2,6 @@ export const USER_EMAIL_LIMIT = 500 | |||
export const USER_PREFERRED_NAME_LIMIT = 100 | |||
export const USER_OVERLIMIT_COPY_LIMIT = 500 | |||
export const USER_REASON_REMOVED_LIMIT = 2000 | |||
export const USER_BATCH_DELETE_LIMIT = 100 |
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.
-1 this is not used anywhere. Did you forget to check this in the mutation?
return {error: {message: 'Provide emails'}} | ||
} | ||
|
||
if (emails.length > USER_EMAIL_LIMIT) { |
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.
-1 wrong limit
} | ||
|
||
if (emails.length > USER_EMAIL_LIMIT) { | ||
return {error: {message: 'Cannot delete more than 100 users at once'}} |
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.
+1 would be nice if the 100 in the error message would be replaced with the limit variable as well.
{authToken, dataLoader}: GQLContext | ||
) => { | ||
if (emails.length === 0) { | ||
return {error: {message: 'Provide emails'}} |
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.
+1 'No emails provided' is more intuitive to understand in my opinion
@@ -0,0 +1,3 @@ | |||
type DeleteUsersSuccess { | |||
success: Boolean! |
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.
+1 this seems redundant because it's always true. A list of deleted emails or just the count might be useful instead.
I think there are 2 possible scenarios we could implement:
|
Description
Part 1 of #10186
Testing scenarios
Final checklist