import Ecto.Query
def run do
- config = Application.get_env(:pleroma, :email_notifications)[:digest]
+ config = Pleroma.Config.get([:email_notifications, :digest])
negative_interval = -Map.fetch!(config, :interval)
inactivity_threshold = Map.fetch!(config, :inactivity_threshold)
inactive_users_query = Pleroma.User.list_inactive_users_query(inactivity_threshold)
|> run()
end
- defp run([]), do: :ok
+ def run([]), do: :ok
- defp run([user | users]) do
+ def run([user | users]) do
with %Swoosh.Email{} = email <- Pleroma.Emails.UserEmail.digest_email(user) do
Pleroma.Emails.Mailer.deliver_async(email)
end