forked from AkkomaGang/akkoma
Fix Credo warnings
This commit is contained in:
parent
60f213bb1a
commit
724311e151
5 changed files with 8 additions and 6 deletions
|
@ -187,7 +187,7 @@ defp hackney_pool_children do
|
|||
end
|
||||
end
|
||||
|
||||
defp after_supervisor_start() do
|
||||
defp after_supervisor_start do
|
||||
with digest_config <- Application.get_env(:pleroma, :email_notifications)[:digest],
|
||||
true <- digest_config[:active],
|
||||
%Crontab.CronExpression{} = schedule <-
|
||||
|
|
|
@ -4,7 +4,7 @@ defmodule Pleroma.DigestEmailWorker do
|
|||
|
||||
# alias Pleroma.User
|
||||
|
||||
def run() do
|
||||
def run do
|
||||
Logger.warn("Running digester")
|
||||
config = Application.get_env(:pleroma, :email_notifications)[:digest]
|
||||
negative_interval = -Map.fetch!(config, :interval)
|
||||
|
@ -14,7 +14,7 @@ def run() do
|
|||
now = NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
|
||||
|
||||
from(u in inactive_users_query,
|
||||
where: fragment("? #> '{\"email_notifications\",\"digest\"}' @> 'true'", u.info),
|
||||
where: fragment(~s(? #> '{"email_notifications","digest"}' @> 'true'), u.info),
|
||||
where: u.last_digest_emailed_at < datetime_add(^now, ^negative_interval, "day"),
|
||||
select: u
|
||||
)
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
defmodule Pleroma.Web.Mailer.SubscriptionController do
|
||||
use Pleroma.Web, :controller
|
||||
|
||||
alias Pleroma.{JWT, Repo, User}
|
||||
alias Pleroma.JWT
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.User
|
||||
|
||||
def unsubscribe(conn, %{"token" => encoded_token}) do
|
||||
with {:ok, token} <- Base.decode64(encoded_token),
|
||||
|
|
2
mix.exs
2
mix.exs
|
@ -8,7 +8,7 @@ def project do
|
|||
elixir: "~> 1.7",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||
# elixirc_options: [warnings_as_errors: true],
|
||||
elixirc_options: [warnings_as_errors: true],
|
||||
xref: [exclude: [:eldap]],
|
||||
start_permanent: Mix.env() == :prod,
|
||||
aliases: aliases(),
|
||||
|
|
|
@ -335,7 +335,7 @@ test "Returns recent notifications" do
|
|||
recent_notifications_ids =
|
||||
user2
|
||||
|> Notification.for_user_since(
|
||||
NaiveDateTime.add(NaiveDateTime.utc_now(), -5 * 86400, :second)
|
||||
NaiveDateTime.add(NaiveDateTime.utc_now(), -5 * 86_400, :second)
|
||||
)
|
||||
|> Enum.map(& &1.id)
|
||||
|
||||
|
|
Loading…
Reference in a new issue