summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2021-02-04 14:33:49 -0600
committerMark Felder <feld@feld.me>2021-02-04 14:33:49 -0600
commitaf37a5c51a3984d8e5ddbe5978b8c3edb7f9bbc2 (patch)
tree42fcf8cbffcb8b5d5929d6140465db70770d427f
parentb22b12f73813b9c46701cac84cfe3a21a5ceacca (diff)
Also make this maybe_ for consistency
-rw-r--r--lib/mix/tasks/pleroma/email.ex2
-rw-r--r--lib/pleroma/user.ex8
-rw-r--r--lib/pleroma/web/pleroma_api/controllers/account_controller.ex2
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex
index e05c207e5..4ce8c9b05 100644
--- a/lib/mix/tasks/pleroma/email.ex
+++ b/lib/mix/tasks/pleroma/email.ex
@@ -38,7 +38,7 @@ defmodule Mix.Tasks.Pleroma.Email do
invisible: false
})
|> Pleroma.Repo.chunk_stream(500)
- |> Stream.each(&Pleroma.User.try_send_confirmation_email(&1))
+ |> Stream.each(&Pleroma.User.maybe_send_confirmation_email(&1))
|> Stream.run()
end
end
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 6aab247d1..7a7956c8f 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -798,7 +798,7 @@ defmodule Pleroma.User do
end
def post_register_action(%User{is_confirmed: false} = user) do
- with {:ok, _} <- try_send_confirmation_email(user) do
+ with {:ok, _} <- maybe_send_confirmation_email(user) do
{:ok, user}
end
end
@@ -870,8 +870,8 @@ defmodule Pleroma.User do
defp maybe_send_welcome_email(_), do: {:ok, :noop}
- @spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
- def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user)
+ @spec maybe_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
+ def maybe_send_confirmation_email(%User{is_confirmed: false, email: email} = user)
when is_binary(email) do
if Config.get([:instance, :account_activation_required]) do
send_confirmation_email(user)
@@ -881,7 +881,7 @@ defmodule Pleroma.User do
end
end
- def try_send_confirmation_email(_), do: {:ok, :noop}
+ def maybe_send_confirmation_email(_), do: {:ok, :noop}
@spec send_confirmation_email(Uset.t()) :: User.t()
def send_confirmation_email(%User{} = user) do
diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex
index bca8e679c..165afd3b4 100644
--- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex
@@ -56,7 +56,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountController do
nickname_or_email = params[:email] || params[:nickname]
with %User{} = user <- User.get_by_nickname_or_email(nickname_or_email),
- {:ok, _} <- User.try_send_confirmation_email(user) do
+ {:ok, _} <- User.maybe_send_confirmation_email(user) do
json_response(conn, :no_content, "")
end
end