You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two models in my application. User and SubUsers. A sub user can belong to multiple users. This means that it is possible that
a User A invites email [email protected] to his portal. And at the same time,
a User B invites email [email protected] to his portal.
Given the current behavior it looks like that only a single invite can be sent to each email at a time. How do I manage this particular scenario?
The text was updated successfully, but these errors were encountered:
I would need more info about what fields User and SubUser have, and how relationships are built. When [email protected] accepts invitation, does it create a User or SubUser? where is email saved?
I think you need to different type of invitations, the invitation from this gem, asking to register and join portal, for first invitation (email doesn't exist yet), and another one asking for joining to a portal for emails which are already registered (they have password).
I guess you need to override the invitations controller, or have a custom invitation action. If user with email exists, then send an email to request user join to a portal, accepting this invitation would be a different action. If user doesn't exist, you could call User.invite! to invite user to join, accepting invitation would use invitation action from this gem. Or you could call User.invite!, if it returns an user with errors, it means user exist and no email was sent, then you can send your own email to ask for joining a portal.
When user doesn't exist, and User A send an invitation, and User B sends another invitation before previous invitation is accepted, invitation token would be overrided. First email will have an invalid invitation token now, accepting second invitation would set the password, and it may join to both portals, depending on your implementation.
I would like to save invitations in a separate table, as requested on issues #388 and and #228, it may help with your request, but I never had time to work on that.
I have two models in my application. User and SubUsers. A sub user can belong to multiple users. This means that it is possible that
a User A invites email [email protected] to his portal. And at the same time,
a User B invites email [email protected] to his portal.
Given the current behavior it looks like that only a single invite can be sent to each email at a time. How do I manage this particular scenario?
The text was updated successfully, but these errors were encountered: