Make it possible to bulk send confirmation emails to all unconfirmed users

This commit is contained in:
Mark Felder 2020-09-08 16:39:08 -05:00
commit 23ca5f75af
3 changed files with 37 additions and 2 deletions

View file

@ -2,7 +2,7 @@ defmodule Mix.Tasks.Pleroma.Email do
use Mix.Task
import Mix.Pleroma
@shortdoc "Simple Email test"
@shortdoc "Email administrative tasks"
@moduledoc File.read!("docs/administration/CLI_tasks/email.md")
def run(["test" | args]) do
@ -21,4 +21,21 @@ defmodule Mix.Tasks.Pleroma.Email do
shell_info("Test email has been sent to #{inspect(email.to)} from #{inspect(email.from)}")
end
def run(["resend_confirmation_emails"]) do
start_pleroma()
Pleroma.User.Query.build(%{
local: true,
deactivated: false,
confirmation_pending: true,
invisible: false
})
|> Pleroma.RepoStreamer.chunk_stream(500)
|> Stream.each(fn users ->
users
|> Enum.each(fn user -> Pleroma.User.send_confirmation_email(user) end)
end)
|> Stream.run()
end
end