EmailTest: use config mock
This commit is contained in:
parent
b13820dcd0
commit
dca41cc4a3
4 changed files with 19 additions and 6 deletions
|
|
@ -14,9 +14,10 @@ defmodule Pleroma.Emails.Mailer do
|
|||
|
||||
@otp_app :pleroma
|
||||
@mailer_config [otp: :pleroma]
|
||||
@config_impl Application.compile_env(:pleroma, [__MODULE__, :config_impl], Pleroma.Config)
|
||||
|
||||
@spec enabled?() :: boolean()
|
||||
def enabled?, do: Pleroma.Config.get([__MODULE__, :enabled])
|
||||
def enabled?, do: @config_impl.get([__MODULE__, :enabled])
|
||||
|
||||
@doc "add email to queue"
|
||||
def deliver_async(email, config \\ []) do
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ defmodule Pleroma.User do
|
|||
]
|
||||
|
||||
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
||||
@config_impl Application.compile_env(:pleroma, [__MODULE__, :config_impl], Pleroma.Config)
|
||||
|
||||
schema "users" do
|
||||
field(:bio, :string, default: "")
|
||||
|
|
@ -1000,7 +1001,7 @@ defmodule Pleroma.User do
|
|||
@spec maybe_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop}
|
||||
def maybe_send_confirmation_email(%User{is_confirmed: false, email: email} = user)
|
||||
when is_binary(email) do
|
||||
if Config.get([:instance, :account_activation_required]) do
|
||||
if @config_impl.get([:instance, :account_activation_required]) do
|
||||
send_confirmation_email(user)
|
||||
{:ok, :enqueued}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue