Revert "Pleroma.Web.AdminAPI.InviteController: dialyzer errors"

This reverts commit db87be126e.
This commit is contained in:
Mark Felder 2024-01-30 14:14:56 -05:00
parent 4227db0871
commit 589456f0ba
2 changed files with 8 additions and 8 deletions

View File

@ -40,7 +40,7 @@ def create(%{body_params: params} = conn, _) do
end end
@doc "Revokes invite by token" @doc "Revokes invite by token"
def revoke(%{body_params: %{"token" => token}} = conn, _) do def revoke(%{body_params: %{token: token}} = conn, _) do
with {:ok, invite} <- UserInviteToken.find_by_token(token), with {:ok, invite} <- UserInviteToken.find_by_token(token),
{:ok, updated_invite} = UserInviteToken.update_invite(invite, %{used: true}) do {:ok, updated_invite} = UserInviteToken.update_invite(invite, %{used: true}) do
render(conn, "show.json", invite: updated_invite) render(conn, "show.json", invite: updated_invite)
@ -51,7 +51,7 @@ def revoke(%{body_params: %{"token" => token}} = conn, _) do
end end
@doc "Sends registration invite via email" @doc "Sends registration invite via email"
def email(%{assigns: %{user: user}, body_params: %{"email" => email} = params} = conn, _) do def email(%{assigns: %{user: user}, body_params: %{email: email} = params} = conn, _) do
with {_, false} <- {:registrations_open, Config.get([:instance, :registrations_open])}, with {_, false} <- {:registrations_open, Config.get([:instance, :registrations_open])},
{_, true} <- {:invites_enabled, Config.get([:instance, :invites_enabled])}, {_, true} <- {:invites_enabled, Config.get([:instance, :invites_enabled])},
{:ok, invite_token} <- UserInviteToken.create_invite(), {:ok, invite_token} <- UserInviteToken.create_invite(),
@ -60,7 +60,7 @@ def email(%{assigns: %{user: user}, body_params: %{"email" => email} = params} =
|> Pleroma.Emails.UserEmail.user_invitation_email( |> Pleroma.Emails.UserEmail.user_invitation_email(
invite_token, invite_token,
email, email,
params["name"] params[:name]
) )
|> Pleroma.Emails.Mailer.deliver() do |> Pleroma.Emails.Mailer.deliver() do
json_response(conn, :no_content, "") json_response(conn, :no_content, "")

View File

@ -79,9 +79,9 @@ def revoke_operation do
"Parameters", "Parameters",
%Schema{ %Schema{
type: :object, type: :object,
required: ["token"], required: [:token],
properties: %{ properties: %{
"token" => %Schema{type: :string} token: %Schema{type: :string}
} }
}, },
required: true required: true
@ -106,10 +106,10 @@ def email_operation do
"Parameters", "Parameters",
%Schema{ %Schema{
type: :object, type: :object,
required: ["email"], required: [:email],
properties: %{ properties: %{
"email" => %Schema{type: :string, format: :email}, email: %Schema{type: :string, format: :email},
"name" => %Schema{type: :string} name: %Schema{type: :string}
} }
}, },
required: true required: true