From b72ab440e9ef0bf9445c3e12a8f2a178838c1b26 Mon Sep 17 00:00:00 2001 From: ruslandoga Date: Wed, 18 Dec 2024 16:16:11 +0700 Subject: [PATCH] Remove old `Plausible.Auth.Invitation` references (#4920) * remove Plausible.Auth.Invitation refs * format * reword --- .../site/memberships/create_invitation.ex | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/plausible/site/memberships/create_invitation.ex b/lib/plausible/site/memberships/create_invitation.ex index cb405624c..418085ba6 100644 --- a/lib/plausible/site/memberships/create_invitation.ex +++ b/lib/plausible/site/memberships/create_invitation.ex @@ -4,7 +4,7 @@ defmodule Plausible.Site.Memberships.CreateInvitation do transfers. """ - alias Plausible.Auth.{User, Invitation} + alias Plausible.Auth.User alias Plausible.Site alias Plausible.Repo alias Plausible.Teams @@ -18,12 +18,14 @@ defmodule Plausible.Site.Memberships.CreateInvitation do | {:over_limit, non_neg_integer()} | :forbidden + @type invitation :: %Teams.GuestInvitation{} | %Teams.SiteTransfer{} + @spec create_invitation(Site.t(), User.t(), String.t(), atom()) :: - {:ok, Invitation.t()} | {:error, invite_error()} + {:ok, invitation} | {:error, invite_error()} @doc """ - Invites a new team member to the given site. Returns a - %Plausible.Auth.Invitation{} struct and sends the invitee an email to accept - this invitation. + Invites a new team member to the given site. Returns either + `%Teams.GuestInvitation{}` or `%Teams.SiteTransfer{}` struct + and sends the invitee an email to accept this invitation. The inviter must have enough permissions to invite the new team member, otherwise this function returns `{:error, :forbidden}`. @@ -38,7 +40,7 @@ defmodule Plausible.Site.Memberships.CreateInvitation do end @spec bulk_create_invitation([Site.t()], User.t(), String.t(), atom(), Keyword.t()) :: - {:ok, [Invitation.t()]} | {:error, invite_error()} + {:ok, [invitation]} | {:error, invite_error()} def bulk_create_invitation(sites, inviter, invitee_email, role, opts \\ []) do Repo.transaction(fn -> for site <- sites do