frain-dev / convoy

The Cloud Native Webhooks Gateway
https://getconvoy.io
Other
2.42k stars 134 forks source link

[Bug Report]: Deleted org members cannot be reinvited to an org #2096

Open BolajiOlajide opened 1 month ago

BolajiOlajide commented 1 month ago

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

if the invite and org member are both deleted and the user isn't deleted I should able to reinvite the user to the same org again

Screenshots

If applicable, could you add screenshots to help explain your problem?

Stack (please complete the following information):

Additional context

Please feel free to add any other context about the problem here.

linear[bot] commented 1 month ago

CON-463 [Bug Report]: Deleted org members cannot be reinvited to an org

BolajiOlajide commented 1 month ago

Okay, this one is quite tricky for a couple of reasons. The bug is caused by a valid database constraint.

CleanShot 2024-07-22 at 23 06 09@2x

The organisation_invites_invitee_email constraint ensures we have invite per user for any given organization, however, this constraint doesn't take into consideration the status of the invite whether it has been accepted or otherwise.

My recommendation is to have this constraint removed, then have the check done in code where we just check if there's a record for organisation_members for that user that isn't deleted.

cc @jirevwe

jirevwe commented 1 month ago

Hmm, alright.