diff options
author | Mark Felder <feld@FreeBSD.org> | 2020-09-08 16:39:08 -0500 |
---|---|---|
committer | Mark Felder <feld@FreeBSD.org> | 2020-09-08 16:39:08 -0500 |
commit | 23ca5f75afa7369ff52772c39dc3324e9402b230 (patch) | |
tree | 8365fbcba394a64b0fbeb854ae78a9abc74bfbe4 /lib/mix/tasks/pleroma/email.ex | |
parent | 7c055af567e08be7f171a2fb687926bef5920899 (diff) | |
download | pleroma-23ca5f75afa7369ff52772c39dc3324e9402b230.tar.gz |
Make it possible to bulk send confirmation emails to all unconfirmed users
Diffstat (limited to 'lib/mix/tasks/pleroma/email.ex')
-rw-r--r-- | lib/mix/tasks/pleroma/email.ex | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex index d3fac6ec8..61d431971 100644 --- a/lib/mix/tasks/pleroma/email.ex +++ b/lib/mix/tasks/pleroma/email.ex @@ -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 |