Write better code
This commit is contained in:
parent
90a97dfc37
commit
5a909e1bf0
@ -23,7 +23,10 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
def check_simple_policy_tuples do
|
||||
has_strings =
|
||||
Config.get([:mrf_simple])
|
||||
|> Enum.map(fn {_, v} -> v == [] || Enum.max(v) end)
|
||||
|> Enum.map(fn
|
||||
{_, []} -> {}
|
||||
{_, v} -> Enum.max(v)
|
||||
end)
|
||||
|> Enum.max()
|
||||
|> is_binary
|
||||
|
||||
@ -76,7 +79,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|
||||
|
||||
Config.put([:mrf_simple], new_config)
|
||||
|
||||
:ok
|
||||
:error
|
||||
else
|
||||
:ok
|
||||
end
|
||||
|
@ -22,7 +22,6 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
|
||||
reject_deletes: ["some.reject.deletes"]
|
||||
)
|
||||
|
||||
# TODO: Can I take the actual config and new config instead? Note that it'll need to be clear where you put the reason.
|
||||
assert capture_log(fn -> DeprecationWarnings.check_simple_policy_tuples() end) =~
|
||||
"""
|
||||
!!!DEPRECATION WARNING!!!
|
||||
|
Loading…
Reference in New Issue
Block a user