X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fworkers%2Fcron%2Fdigest_emails_worker.ex;h=0c56f00fb4ec65d91fd9ad82c1499ba4ed1f18a5;hb=a65fc78c6a14e1333ce71d28824a490a8a6da69b;hp=0a00129df86ac8e4e162b91c79f5354c54166f28;hpb=5fc2fa89086e820352a9fec571f07f29a55c4f06;p=akkoma
diff --git a/lib/pleroma/workers/cron/digest_emails_worker.ex b/lib/pleroma/workers/cron/digest_emails_worker.ex
index 0a00129df..0c56f00fb 100644
--- a/lib/pleroma/workers/cron/digest_emails_worker.ex
+++ b/lib/pleroma/workers/cron/digest_emails_worker.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.Cron.DigestEmailsWorker do
@@ -19,7 +19,7 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorker do
require Logger
@impl Oban.Worker
- def perform(_opts, _job) do
+ def perform(_job) do
config = Config.get([:email_notifications, :digest])
if config[:active] do
@@ -31,12 +31,15 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorker do
from(u in inactive_users_query,
where: fragment(~s(? ->'digest' @> 'true'), u.email_notifications),
+ where: not is_nil(u.email),
where: u.last_digest_emailed_at < datetime_add(^now, ^negative_interval, "day"),
select: u
)
|> Repo.all()
|> send_emails
end
+
+ :ok
end
def send_emails(users) do