Invite throws 422 for existing but expired invites

When trying to invite a user, we frequently see 422 Unprocessable Entity.
The code checks for existing invites for that email address and throws an error when it finds one. However it seems to ignore if such an invite has expired or has been invalidated. Should the invite be possible in those cases?

Testing this on the latest Discourse code on my local dev site, I’m actually able to create multiple invites for the same email address. Looking at the code, I would have expected doing that to throw an error.

You should definitely be able to send a new invite to an email address that an expired invite exists for. A lot of work has been going on with the Discourse Invite system lately. What version of Discourse are you running into the issue on?

1 Like

That’s even more odd :thinking:

We ran into this on tests-passed as of April 28.

At least our findings seem to be consistent with the code, and that code seems wrong?

Any ideas on this @dan?

1 Like

I reverted to the old behavior in this PR. This means that it will update and return the existing invite instead of returning 422.

3 Likes

This topic was automatically closed after 6 days. New replies are no longer allowed.