- Notifications
You must be signed in to change notification settings - Fork1k
feat: notify when a user account is deleted#14113
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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.
Good stuff, a couple things I think we need to consider before merging though.
Uh oh!
There was an error while loading.Please reload this page.
iferr!=nil { | ||
returnnil,xerrors.Errorf("get owners: %w",err) | ||
} | ||
userAdmins,err:=store.GetUsers(ctx, database.GetUsersParams{ |
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.
Do we also need to include org user admins here?
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.
Probably, I will leave it as a follow-up once the org part is final. Most likely we need to adjustcreate account logic too.
// then | ||
require.Len(t,notifyEnq.Sent,2) | ||
// notifyEnq.Sent[0] is create account event | ||
require.Equal(t,notifications.TemplateUserAccountDeleted,notifyEnq.Sent[1].TemplateID) |
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.
Should the owner receive an email for their own action?
We're suppressing this for users who delete their own workspaces, for example, so I wonder if we should follow the same pattern. Possible follow-up though, non-blocking.
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.
You can't delete your own account, so I believe there is no need to filter.
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.
What i mean is: if an owner initiated an event - they should probably not receive a notification about it because it's redundant.
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 understand that they won't receive as the API method will fail faster? seecode
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.
Oh.. you mean the owner of the action.. not the owner of the account. Interesting case, on the other hand, if somebody took over the account, notifications would work like auditing.
Uh oh!
There was an error while loading.Please reload this page.
Related:coder/internal#17
This PR extends
api.deleteUser
to notify owners and user admins when somebody deletes a new user.