FIX: Remove user's associated invite objects (PR #12927)

Issue: Getting 422 response when trying to create invite for a deleted user.

Steps to reproduce:

  1. Invite a user through API
  2. Accept the invite
  3. Delete the user from admin settings
  4. Create an invite with the same email

This will result in 422 because there will be an existing invite for the same email. The fix is to remove the invite based relations of a user when the user is destroyed.


Thanks, this looks good.

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

Awesome, works now. Thanks!