Verified Commit c0489f9f authored by Ilja's avatar Ilja Committed by Haelwenn
Browse files

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.
parent 64002e92
...@@ -170,23 +170,24 @@ def check_hellthread_threshold do ...@@ -170,23 +170,24 @@ def check_hellthread_threshold do
end end
def warn do def warn do
with :ok <- check_hellthread_threshold(), [
:ok <- check_old_mrf_config(), check_hellthread_threshold(),
:ok <- check_media_proxy_whitelist_config(), check_old_mrf_config(),
:ok <- check_welcome_message_config(), check_media_proxy_whitelist_config(),
:ok <- check_gun_pool_options(), check_welcome_message_config(),
:ok <- check_activity_expiration_config(), check_gun_pool_options(),
:ok <- check_remote_ip_plug_name(), check_activity_expiration_config(),
:ok <- check_uploders_s3_public_endpoint(), check_remote_ip_plug_name(),
:ok <- check_old_chat_shoutbox(), check_uploders_s3_public_endpoint(),
:ok <- check_quarantined_instances_tuples(), check_old_chat_shoutbox(),
:ok <- check_transparency_exclusions_tuples(), check_quarantined_instances_tuples(),
:ok <- check_simple_policy_tuples() do check_transparency_exclusions_tuples(),
:ok check_simple_policy_tuples()
else ]
_ -> |> Enum.reduce(:ok, fn
:error :ok, :ok -> :ok
end _, _ -> :error
end)
end end
def check_welcome_message_config do def check_welcome_message_config do
......
...@@ -73,7 +73,7 @@ test "transforms config to tuples" do ...@@ -73,7 +73,7 @@ test "transforms config to tuples" do
{:media_removal, [{"some.removal", ""}, {"some.other.instance", "Some reason"}]} {: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 assert Config.get([:mrf_simple]) == expected_config
end end
...@@ -122,7 +122,7 @@ test "transforms config to tuples" do ...@@ -122,7 +122,7 @@ test "transforms config to tuples" do
expected_config = [{"domain.com", "some reason"}, {"some.tld", ""}] 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 assert Config.get([:instance, :quarantined_instances]) == expected_config
end end
...@@ -172,7 +172,7 @@ test "transforms config to tuples" do ...@@ -172,7 +172,7 @@ test "transforms config to tuples" do
expected_config = [{"domain.com", "some reason"}, {"some.tld", ""}] 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 assert Config.get([:mrf, :transparency_exclusions]) == expected_config
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment