Registration: user state is separate from instance state
This commit is contained in:
parent
b2fed59209
commit
c69b205409
@ -772,33 +772,18 @@ defmodule Pleroma.User do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def post_register_action(%User{} = user) do
|
def post_register_action(%User{confirmation_pending: true} = user) do
|
||||||
instance_config =
|
|
||||||
Config.get(:instance)
|
|
||||||
|> Enum.into(%{})
|
|
||||||
|
|
||||||
do_post_register_action(user, instance_config)
|
|
||||||
end
|
|
||||||
|
|
||||||
defp do_post_register_action(%User{confirmation_pending: true} = user, %{
|
|
||||||
account_activation_required: true
|
|
||||||
}) do
|
|
||||||
with {:ok, _} <- try_send_confirmation_email(user) do
|
with {:ok, _} <- try_send_confirmation_email(user) do
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_post_register_action(%User{approval_pending: true} = user, %{
|
def post_register_action(%User{approval_pending: true} = user) do
|
||||||
account_approval_required: true
|
|
||||||
}) do
|
|
||||||
# TODO: Send approval explanation email
|
# TODO: Send approval explanation email
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp do_post_register_action(
|
def post_register_action(%User{approval_pending: false, confirmation_pending: false} = user) do
|
||||||
%User{approval_pending: false, confirmation_pending: false} = user,
|
|
||||||
_instance_config
|
|
||||||
) do
|
|
||||||
with {:ok, user} <- autofollow_users(user),
|
with {:ok, user} <- autofollow_users(user),
|
||||||
{:ok, user} <- set_cache(user),
|
{:ok, user} <- set_cache(user),
|
||||||
{:ok, _} <- send_welcome_email(user),
|
{:ok, _} <- send_welcome_email(user),
|
||||||
|
Loading…
Reference in New Issue
Block a user