X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fmix%2Ftasks%2Fpleroma%2Fdigest.ex;h=0c14694323b879df699d247825d211945bf447d3;hb=b98fe4476c13f213f5a4c928b7946516374e133b;hp=81c207e10848f92aab6f9695f003a35127845244;hpb=8292331b35f088a19a4d14eff69b74a6d1ed4746;p=akkoma
diff --git a/lib/mix/tasks/pleroma/digest.ex b/lib/mix/tasks/pleroma/digest.ex
index 81c207e10..0c1469432 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/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}
- _user = Pleroma.DigestEmailWorker.perform(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