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 @@ defmodule Pleroma.Web.AdminAPI.InviteController do
end
@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),
{:ok, updated_invite} = UserInviteToken.update_invite(invite, %{used: true}) do
render(conn, "show.json", invite: updated_invite)
@ -51,7 +51,7 @@ defmodule Pleroma.Web.AdminAPI.InviteController do
end
@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])},
{_, true} <- {:invites_enabled, Config.get([:instance, :invites_enabled])},
{:ok, invite_token} <- UserInviteToken.create_invite(),
@ -60,7 +60,7 @@ defmodule Pleroma.Web.AdminAPI.InviteController do
|> Pleroma.Emails.UserEmail.user_invitation_email(
invite_token,
email,
params["name"]
params[:name]
)
|> Pleroma.Emails.Mailer.deliver() do
json_response(conn, :no_content, "")

View File

@ -79,9 +79,9 @@ defmodule Pleroma.Web.ApiSpec.Admin.InviteOperation do
"Parameters",
%Schema{
type: :object,
required: ["token"],
required: [:token],
properties: %{
"token" => %Schema{type: :string}
token: %Schema{type: :string}
}
},
required: true
@ -106,10 +106,10 @@ defmodule Pleroma.Web.ApiSpec.Admin.InviteOperation do
"Parameters",
%Schema{
type: :object,
required: ["email"],
required: [:email],
properties: %{
"email" => %Schema{type: :string, format: :email},
"name" => %Schema{type: :string}
email: %Schema{type: :string, format: :email},
name: %Schema{type: :string}
}
},
required: true