Remove old Plausible.Auth.Invitation references (#4920)

* remove Plausible.Auth.Invitation refs

* format

* reword
This commit is contained in:
ruslandoga 2024-12-18 16:16:11 +07:00 committed by GitHub
parent 98b64b4891
commit b72ab440e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ defmodule Plausible.Site.Memberships.CreateInvitation do
transfers. transfers.
""" """
alias Plausible.Auth.{User, Invitation} alias Plausible.Auth.User
alias Plausible.Site alias Plausible.Site
alias Plausible.Repo alias Plausible.Repo
alias Plausible.Teams alias Plausible.Teams
@ -18,12 +18,14 @@ defmodule Plausible.Site.Memberships.CreateInvitation do
| {:over_limit, non_neg_integer()} | {:over_limit, non_neg_integer()}
| :forbidden | :forbidden
@type invitation :: %Teams.GuestInvitation{} | %Teams.SiteTransfer{}
@spec create_invitation(Site.t(), User.t(), String.t(), atom()) :: @spec create_invitation(Site.t(), User.t(), String.t(), atom()) ::
{:ok, Invitation.t()} | {:error, invite_error()} {:ok, invitation} | {:error, invite_error()}
@doc """ @doc """
Invites a new team member to the given site. Returns a Invites a new team member to the given site. Returns either
%Plausible.Auth.Invitation{} struct and sends the invitee an email to accept `%Teams.GuestInvitation{}` or `%Teams.SiteTransfer{}` struct
this invitation. and sends the invitee an email to accept this invitation.
The inviter must have enough permissions to invite the new team member, The inviter must have enough permissions to invite the new team member,
otherwise this function returns `{:error, :forbidden}`. otherwise this function returns `{:error, :forbidden}`.
@ -38,7 +40,7 @@ defmodule Plausible.Site.Memberships.CreateInvitation do
end end
@spec bulk_create_invitation([Site.t()], User.t(), String.t(), atom(), Keyword.t()) :: @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 def bulk_create_invitation(sites, inviter, invitee_email, role, opts \\ []) do
Repo.transaction(fn -> Repo.transaction(fn ->
for site <- sites do for site <- sites do