jazzband / django-invitations

Generic invitations app for Django
GNU General Public License v3.0
559 stars 166 forks source link

Seems a bug: views.SendJSONInvite.post creates invite without deleting a previous invalidate one #243

Open Huge opened 6 months ago

Huge commented 6 months ago

/invitations/views.py, line 72 fails with django.db.utils.IntegrityError: UNIQUE constraint failed: invitations_invitation.email when a user was invited previously but their invitation expired.

There seem two ways to fix it - either improve the Invitation class create method to remove the invalid invitation first or fix the logic of the CleanEmailMixin().validate_invitation(invitee).

I want to fix it, so probably I would provide a PR...