Merge branch 'develop' of https://git.pleroma.social/pleroma/pleroma into develop
[akkoma] / lib / pleroma / config / deprecation_warnings.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Config.DeprecationWarnings do
6 require Logger
7 alias Pleroma.Config
8
9 def check_hellthread_threshold do
10 if Config.get([:mrf_hellthread, :threshold]) do
11 Logger.warn("""
12 !!!DEPRECATION WARNING!!!
13 You are using the old configuration mechanism for the hellthread filter. Please check config.md.
14 """)
15 end
16 end
17
18 def mrf_user_allowlist do
19 config = Config.get(:mrf_user_allowlist)
20
21 if config && Enum.any?(config, fn {k, _} -> is_atom(k) end) do
22 rewritten =
23 Enum.reduce(Config.get(:mrf_user_allowlist), Map.new(), fn {k, v}, acc ->
24 Map.put(acc, to_string(k), v)
25 end)
26
27 Config.put(:mrf_user_allowlist, rewritten)
28
29 Logger.error("""
30 !!!DEPRECATION WARNING!!!
31 As of Pleroma 2.0.7, the `mrf_user_allowlist` setting changed of format.
32 Pleroma 2.1 will remove support for the old format. Please change your configuration to match this:
33
34 config :pleroma, :mrf_user_allowlist, #{inspect(rewritten, pretty: true)}
35 """)
36 end
37 end
38
39 def warn do
40 check_hellthread_threshold()
41 mrf_user_allowlist()
42 end
43 end