Handle possibility of user account in a bulk operation not having an email address
This commit is contained in:
parent
75b6fef25d
commit
d23d0c27c2
|
@ -34,7 +34,7 @@ def run(["resend_confirmation_emails"]) do
|
|||
|> Pleroma.RepoStreamer.chunk_stream(500)
|
||||
|> Stream.each(fn users ->
|
||||
users
|
||||
|> Enum.each(fn user -> Pleroma.User.send_confirmation_email(user) end)
|
||||
|> Enum.each(fn user -> Pleroma.User.try_send_confirmation_email(user) end)
|
||||
end)
|
||||
|> Stream.run()
|
||||
end
|
||||
|
|
|
@ -814,7 +814,8 @@ def send_welcome_email(%User{email: email} = user) when is_binary(email) do
|
|||
def send_welcome_email(_), do: {:ok, :noop}
|
||||
|
||||
@spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
|
||||
def try_send_confirmation_email(%User{confirmation_pending: true} = user) do
|
||||
def try_send_confirmation_email(%User{confirmation_pending: true, email: email} = user)
|
||||
when is_binary(email) do
|
||||
if Config.get([:instance, :account_activation_required]) do
|
||||
send_confirmation_email(user)
|
||||
{:ok, :enqueued}
|
||||
|
|
Loading…
Reference in New Issue