mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 01:22:15 +03:00
Clean up guest invitations selectively after accepting (#4778)
This commit is contained in:
parent
1e1a4ab35b
commit
c0a8aa025c
@ -271,7 +271,10 @@ defmodule Plausible.Teams.Invitations do
|
||||
create_team_membership(team_invitation.team, team_invitation.role, user, now),
|
||||
{:ok, _guest_memberships} <-
|
||||
create_guest_memberships(team_membership, guest_invitations, now) do
|
||||
Repo.delete!(team_invitation)
|
||||
# Clean up guest invitations after accepting
|
||||
guest_invitation_ids = Enum.map(guest_invitations, & &1.id)
|
||||
Repo.delete_all(from gi in Teams.GuestInvitation, where: gi.id in ^guest_invitation_ids)
|
||||
prune_guest_invitations(team_invitation.team)
|
||||
|
||||
if send_email? do
|
||||
send_invitation_accepted_email(team_invitation, guest_invitations)
|
||||
|
Loading…
Reference in New Issue
Block a user