View Source Plausible.Site.Memberships.AcceptInvitation (Plausible v0.0.1)

Service for accepting invitations, including ownership transfers.

Accepting invitation accounts for the fact that it's possible that accepting user has an existing membership for the site and acts permissively to not unnecessarily disrupt the flow while also maintaining integrity of site memberships. This also applies to cases where users update their email address between issuing the invitation and accepting it.

Summary

Functions

Link to this function

accept_invitation(invitation_id, user)

View Source
@spec accept_invitation(String.t(), Plausible.Auth.User.t()) ::
  {:ok, Plausible.Site.Membership.t()}
  | {:error,
     :invitation_not_found
     | Plausible.Billing.Quota.Limits.over_limits_error()
     | Ecto.Changeset.t()
     | :no_plan}
Link to this function

transfer_ownership(site, user)

View Source
@spec transfer_ownership(Plausible.Site.t(), Plausible.Auth.User.t()) ::
  {:ok, Plausible.Site.Membership.t()}
  | {:error,
     Plausible.Billing.Quota.Limits.over_limits_error()
     | Ecto.Changeset.t()
     | :transfer_to_self
     | :no_plan}