diff options
author | Ilja <domainepublic@spectraltheorem.be> | 2020-10-02 16:03:20 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2021-08-06 07:59:52 +0200 |
commit | e0c7d7719797bad0edf7e5c5bd0d3c43cace6f36 (patch) | |
tree | 0be5338c35c30557f4ee6f19aab73d454e5aef04 /lib | |
parent | 27fe7b0274cd9904d91167adade2cf7e56fd482b (diff) | |
download | pleroma-e0c7d7719797bad0edf7e5c5bd0d3c43cace6f36.tar.gz pleroma-e0c7d7719797bad0edf7e5c5bd0d3c43cace6f36.zip |
Deprecate and rewrite settings for quarentine settings
* This is for the settings, not yet a DB migration
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/config/deprecation_warnings.ex | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index dd5c81094..37f783fec 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -80,6 +80,44 @@ defmodule Pleroma.Config.DeprecationWarnings do end end + def check_quarantined_instances_tuples do + has_strings = + Config.get([:instance, :quarantined_instances]) |> Enum.any?(fn e -> is_binary(e) end) + + if has_strings do + Logger.warn(""" + !!!DEPRECATION WARNING!!! + Your config is using strings in the quarantined_instances configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: + + ``` + config :pleroma, :instance, + quarantined_instances: ["instance.tld"] + ``` + + Is now + + + ``` + config :pleroma, :instance, + quarantined_instances: [{"instance.tld", "Reason for quarantine"}] + ``` + """) + + new_config = + Config.get([:instance, :quarantined_instances]) + |> Enum.map(fn + {instance, reason} -> {instance, reason} + instance -> {instance, ""} + end) + + Config.put([:instance, :quarantined_instances], new_config) + + :error + else + :ok + end + end + def check_hellthread_threshold do if Config.get([:mrf_hellthread, :threshold]) do Logger.warn(""" @@ -103,6 +141,7 @@ defmodule Pleroma.Config.DeprecationWarnings do :ok <- check_remote_ip_plug_name(), :ok <- check_uploders_s3_public_endpoint(), :ok <- check_old_chat_shoutbox(), + :ok <- check_quarantined_instances_tuples(), :ok <- check_simple_policy_tuples() do :ok else |