These welcome emails are not guaranteed and can be private functions

This commit is contained in:
Mark Felder 2021-02-04 14:01:15 -06:00
parent d7262f7d22
commit b22b12f738

View File

@ -814,9 +814,9 @@ def post_register_action(%User{is_approved: true, is_confirmed: true} = user) do
with {:ok, user} <- autofollow_users(user), with {:ok, user} <- autofollow_users(user),
{:ok, _} <- autofollowing_users(user), {:ok, _} <- autofollowing_users(user),
{:ok, user} <- set_cache(user), {:ok, user} <- set_cache(user),
{:ok, _} <- send_welcome_email(user), {:ok, _} <- maybe_send_welcome_email(user),
{:ok, _} <- send_welcome_message(user), {:ok, _} <- maybe_send_welcome_message(user),
{:ok, _} <- send_welcome_chat_message(user) do {:ok, _} <- maybe_send_welcome_chat_message(user) do
{:ok, user} {:ok, user}
end end
end end
@ -841,7 +841,7 @@ defp send_admin_approval_emails(user) do
{:ok, :enqueued} {:ok, :enqueued}
end end
def send_welcome_message(user) do defp maybe_send_welcome_message(user) do
if User.WelcomeMessage.enabled?() do if User.WelcomeMessage.enabled?() do
User.WelcomeMessage.post_message(user) User.WelcomeMessage.post_message(user)
{:ok, :enqueued} {:ok, :enqueued}
@ -850,7 +850,7 @@ def send_welcome_message(user) do
end end
end end
def send_welcome_chat_message(user) do defp maybe_send_welcome_chat_message(user) do
if User.WelcomeChatMessage.enabled?() do if User.WelcomeChatMessage.enabled?() do
User.WelcomeChatMessage.post_message(user) User.WelcomeChatMessage.post_message(user)
{:ok, :enqueued} {:ok, :enqueued}
@ -859,7 +859,7 @@ def send_welcome_chat_message(user) do
end end
end end
def send_welcome_email(%User{email: email} = user) when is_binary(email) do defp maybe_send_welcome_email(%User{email: email} = user) when is_binary(email) do
if User.WelcomeEmail.enabled?() do if User.WelcomeEmail.enabled?() do
User.WelcomeEmail.send_email(user) User.WelcomeEmail.send_email(user)
{:ok, :enqueued} {:ok, :enqueued}
@ -868,7 +868,7 @@ def send_welcome_email(%User{email: email} = user) when is_binary(email) do
end end
end end
def send_welcome_email(_), do: {:ok, :noop} defp maybe_send_welcome_email(_), do: {:ok, :noop}
@spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop} @spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user) def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user)