1 defmodule Mix.Tasks.Pleroma.Digest do
5 @shortdoc "Manages digest emails"
6 @moduledoc File.read!("docs/administration/CLI_tasks/digest.md")
8 def run(["test", nickname | opts]) do
9 Mix.Pleroma.start_pleroma()
11 user = Pleroma.User.get_by_nickname(nickname)
13 last_digest_emailed_at =
15 {:ok, datetime} <- Timex.parse(date, "{YYYY}-{0M}-{0D}") do
21 patched_user = %{user | last_digest_emailed_at: last_digest_emailed_at}
23 with %Swoosh.Email{} = email <- Pleroma.Emails.UserEmail.digest_email(patched_user) do
24 {:ok, _} = Pleroma.Emails.Mailer.deliver(email)
26 shell_info("Digest email have been sent to #{nickname} (#{user.email})")
29 shell_info("Cound't find any mentions for #{nickname} since #{last_digest_emailed_at}")