diff options
author | Ilja <domainepublic@spectraltheorem.be> | 2020-10-05 11:26:08 +0200 |
---|---|---|
committer | Ilja <domainepublic@spectraltheorem.be> | 2020-10-05 11:26:08 +0200 |
commit | 9a213ee9ee15c87d66c0fd3e06c1915fbc2c2f12 (patch) | |
tree | b39700e8c53e1c084511ee69c502d075db0c1c6c | |
parent | 3ea3f49268e8f28e3b64340d855341eff9e3cf1a (diff) | |
download | pleroma-9a213ee9ee15c87d66c0fd3e06c1915fbc2c2f12.tar.gz |
Fixed deprecation warning checks
When a setting was deprecated, the code would stop checking for the rest of the possible deprications. This also meant that the settings weren't rewritten to the new settings for deprecated settings besides the first one.
-rw-r--r-- | lib/pleroma/config/deprecation_warnings.ex | 29 | ||||
-rw-r--r-- | test/config/deprecation_warnings_test.exs | 6 |
2 files changed, 18 insertions, 17 deletions
diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index d5b2f51db..d5f68568a 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -170,20 +170,21 @@ defmodule Pleroma.Config.DeprecationWarnings do end def warn do - with :ok <- check_hellthread_threshold(), - :ok <- check_old_mrf_config(), - :ok <- check_media_proxy_whitelist_config(), - :ok <- check_welcome_message_config(), - :ok <- check_gun_pool_options(), - :ok <- check_activity_expiration_config(), - :ok <- check_quarantined_instances_tuples(), - :ok <- check_transparency_exclusions_tuples(), - :ok <- check_simple_policy_tuples() do - :ok - else - _ -> - :error - end + [ + check_hellthread_threshold(), + check_old_mrf_config(), + check_media_proxy_whitelist_config(), + check_welcome_message_config(), + check_gun_pool_options(), + check_activity_expiration_config(), + check_quarantined_instances_tuples(), + check_transparency_exclusions_tuples(), + check_simple_policy_tuples() + ] + |> Enum.reduce(:ok, fn + :ok, :ok -> :ok + _, _ -> :error + end) end def check_welcome_message_config do diff --git a/test/config/deprecation_warnings_test.exs b/test/config/deprecation_warnings_test.exs index ecb4fa7f7..d93e51cf2 100644 --- a/test/config/deprecation_warnings_test.exs +++ b/test/config/deprecation_warnings_test.exs @@ -69,7 +69,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do {:media_removal, [{"some.removal", ""}, {"some.other.instance", "Some reason"}]} ] - capture_log(fn -> DeprecationWarnings.check_simple_policy_tuples() end) + capture_log(fn -> DeprecationWarnings.warn() end) assert Config.get([:mrf_simple]) == expected_config end @@ -118,7 +118,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do expected_config = [{"domain.com", "some reason"}, {"some.tld", ""}] - capture_log(fn -> DeprecationWarnings.check_quarantined_instances_tuples() end) + capture_log(fn -> DeprecationWarnings.warn() end) assert Config.get([:instance, :quarantined_instances]) == expected_config end @@ -168,7 +168,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do expected_config = [{"domain.com", "some reason"}, {"some.tld", ""}] - capture_log(fn -> DeprecationWarnings.check_transparency_exclusions_tuples() end) + capture_log(fn -> DeprecationWarnings.warn() end) assert Config.get([:mrf, :transparency_exclusions]) == expected_config end |