Probably an edge case here but while testing an API endpoint (/invites.json) all works well. I then deleted the invited user and now I get a 422 response from that endpoint. Using the data explorer, I can see the user no longer exists, but the invite is still listed in the invites table.
Is it possible to invite a user with an email address that has been previously deleted?
Okay I haven’t been able to reproduce the way you’ve described unless i’m misunderstanding something about what you are hoping to do (totally possible). It might help if you explain what you expected to see vs what you are actually seeing.
But I’m using:
Version: 2.7.0beta7 OS: Ubuntu 20.04.1 LTS
& i did the following:
invite user with a specific email address from the UI, Admin > Users > Send Invites
Invite and selected the option to restrict invite to a specific email address
accepted the invite from the specified email address in a separate incognito window
as an admin user in my original window - deleted the newly signed up user
used Postman to send a GET to https://example.dev/u/my-dev-user/invited.json
is this the endpoint you were using? you mentioned /invites.json but i get a 404 using that regardless, i’m not entirely sure it exists.
Received the following response after deleting the user, which is what i expected since I deleted the user none pending, none redeemed, and none expired:
I think that perhaps the bug fix has been reverted or no longer works as I encountered this bug today. I followed the steps below to identify the problem.
Deleted a user in the admin panel
Invited the user via the API
Got the failed message
Deleted the pending invites for the deleted user
Invited the deleted user via the API
Got the success message
Received the invite but when clicked I got the warning “Sorry! This invitation is intended for new users, who do not already have an existing account.”
Neither the API or the admin panel can find the deleted user
*Finally, I tried to open the invite link in an incognito window and I was then able to log in as a new user- possible a problem with cookies?
I tried to reproduce the bug, but for me it worked to re-invite a user who was deleted. I tried using both email and link invites.
Are you sure that you were not logged in when you accessed the invite page? There is a single code path that displays this message and I see no obvious problems.