mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-27 02:20:29 +00:00
Remove debug code
This commit is contained in:
parent
2359ee38b3
commit
f1d90ee942
1 changed files with 1 additions and 14 deletions
|
@ -1,11 +1,7 @@
|
||||||
defmodule Pleroma.DigestEmailWorker do
|
defmodule Pleroma.DigestEmailWorker do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
require Logger
|
|
||||||
|
|
||||||
# alias Pleroma.User
|
|
||||||
|
|
||||||
def run do
|
def run do
|
||||||
Logger.warn("Running digester")
|
|
||||||
config = Application.get_env(:pleroma, :email_notifications)[:digest]
|
config = Application.get_env(:pleroma, :email_notifications)[:digest]
|
||||||
negative_interval = -Map.fetch!(config, :interval)
|
negative_interval = -Map.fetch!(config, :interval)
|
||||||
inactivity_threshold = Map.fetch!(config, :inactivity_threshold)
|
inactivity_threshold = Map.fetch!(config, :inactivity_threshold)
|
||||||
|
@ -19,23 +15,14 @@ defmodule Pleroma.DigestEmailWorker do
|
||||||
select: u
|
select: u
|
||||||
)
|
)
|
||||||
|> Pleroma.Repo.all()
|
|> Pleroma.Repo.all()
|
||||||
|> run(:pre)
|
|> run()
|
||||||
end
|
|
||||||
|
|
||||||
defp run(v, :pre) do
|
|
||||||
Logger.warn("Running for #{length(v)} users")
|
|
||||||
run(v)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
defp run([]), do: :ok
|
defp run([]), do: :ok
|
||||||
|
|
||||||
defp run([user | users]) do
|
defp run([user | users]) do
|
||||||
with %Swoosh.Email{} = email <- Pleroma.Emails.UserEmail.digest_email(user) do
|
with %Swoosh.Email{} = email <- Pleroma.Emails.UserEmail.digest_email(user) do
|
||||||
Logger.warn("Sending to #{user.nickname}")
|
|
||||||
Pleroma.Emails.Mailer.deliver_async(email)
|
Pleroma.Emails.Mailer.deliver_async(email)
|
||||||
else
|
|
||||||
_ ->
|
|
||||||
Logger.warn("Skipping #{user.nickname}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Pleroma.User.touch_last_digest_emailed_at(user)
|
Pleroma.User.touch_last_digest_emailed_at(user)
|
||||||
|
|
Loading…
Reference in a new issue