diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-08-31 21:58:42 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-08-31 21:58:42 +0300 |
commit | dd017c65a4b86501c435f5cb01804300e6b7c6dd (patch) | |
tree | 974377c7e52c8960251881cb939632ea8288dbb6 /lib/pleroma/emails/mailer.ex | |
parent | a90ea8ba1562818b025f677ffeea35f7ca08ddf2 (diff) | |
download | pleroma-dd017c65a4b86501c435f5cb01804300e6b7c6dd.tar.gz |
[#1149] Refactored Oban workers API (introduced `enqueue/3`).
Diffstat (limited to 'lib/pleroma/emails/mailer.ex')
-rw-r--r-- | lib/pleroma/emails/mailer.ex | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/pleroma/emails/mailer.ex b/lib/pleroma/emails/mailer.ex index 9cbe7313c..eb96f2e8b 100644 --- a/lib/pleroma/emails/mailer.ex +++ b/lib/pleroma/emails/mailer.ex @@ -9,7 +9,6 @@ defmodule Pleroma.Emails.Mailer do The module contains functions to delivery email using Swoosh.Mailer. """ - alias Pleroma.Repo alias Pleroma.Workers.MailerWorker alias Swoosh.DeliveryError @@ -19,8 +18,6 @@ defmodule Pleroma.Emails.Mailer do @spec enabled?() :: boolean() def enabled?, do: Pleroma.Config.get([__MODULE__, :enabled]) - import Pleroma.Workers.WorkerHelper, only: [worker_args: 1] - @doc "add email to queue" def deliver_async(email, config \\ []) do encoded_email = @@ -28,9 +25,7 @@ defmodule Pleroma.Emails.Mailer do |> :erlang.term_to_binary() |> Base.encode64() - %{"op" => "email", "encoded_email" => encoded_email, "config" => config} - |> MailerWorker.new(worker_args(:mailer)) - |> Repo.insert() + MailerWorker.enqueue("email", %{"encoded_email" => encoded_email, "config" => config}) end @doc "callback to perform send email from queue" |