X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmix%2Ftasks%2Fpleroma%2Fdigest.ex;h=f34fc839e6f0633b62df39969464040a63d0d0ba;hb=a52cedba6211e0f8ef221458efe5b1cd151faf0f;hp=19c4ce71e58940c5793b38889ca6dd4c0e81cac8;hpb=d2cb18b2a342b990cc47dfdc42adb843c3db1b5e;p=akkoma
diff --git a/lib/mix/tasks/pleroma/digest.ex b/lib/mix/tasks/pleroma/digest.ex
index 19c4ce71e..f34fc839e 100644
--- a/lib/mix/tasks/pleroma/digest.ex
+++ b/lib/mix/tasks/pleroma/digest.ex
@@ -1,17 +1,14 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2021 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Mix.Tasks.Pleroma.Digest do
use Mix.Task
+ import Mix.Pleroma
@shortdoc "Manages digest emails"
- @moduledoc """
- Manages digest emails
-
- ## Send digest email since given date (user registration date by default)
- ignoring user activity status.
+ @moduledoc File.read!("docs/administration/CLI_tasks/digest.md")
- ``mix pleroma.digest test ``
-
- Example: ``mix pleroma.digest test donaldtheduck 2019-05-20``
- """
def run(["test", nickname | opts]) do
Mix.Pleroma.start_pleroma()
@@ -27,7 +24,13 @@ defmodule Mix.Tasks.Pleroma.Digest do
patched_user = %{user | last_digest_emailed_at: last_digest_emailed_at}
- :ok = Pleroma.DigestEmailWorker.run([patched_user])
- Mix.shell().info("Digest email have been sent to #{nickname} (#{user.email})")
+ with %Swoosh.Email{} = email <- Pleroma.Emails.UserEmail.digest_email(patched_user) do
+ {:ok, _} = Pleroma.Emails.Mailer.deliver(email)
+
+ shell_info("Digest email have been sent to #{nickname} (#{user.email})")
+ else
+ _ ->
+ shell_info("Cound't find any mentions for #{nickname} since #{last_digest_emailed_at}")
+ end
end
end