Skip to content

fix: handle re-inviting users with expired invitations#38

Merged
maartenbode merged 1 commit intomainfrom
fix/expired-invitation-resend
Mar 20, 2026
Merged

fix: handle re-inviting users with expired invitations#38
maartenbode merged 1 commit intomainfrom
fix/expired-invitation-resend

Conversation

@maartenbode
Copy link
Member

Summary

  • Fixes UniqueConstraintViolationException when re-inviting a user whose previous invitation has expired
  • The pendingInvitations() scope filters out expired invites (expires_at > now()), so the duplicate check in MemberController::store doesn't catch them, but the DB unique constraint on (organization_uuid, email) blocks the insert
  • Changed OrganizationInvitation::create() to updateOrCreate() so expired invitations get refreshed (new token, expiry, role, inviter) instead of causing a duplicate key error

@maartenbode maartenbode merged commit 8e5d860 into main Mar 20, 2026
2 checks passed
@maartenbode maartenbode deleted the fix/expired-invitation-resend branch March 20, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant