From: Alexander Strizhakov Date: Thu, 23 Jan 2020 15:21:29 +0000 (+0300) Subject: parsing Swoosh modules X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=6cd2e851d9d61ce82edf83ced79c9d4c613c0373;p=akkoma parsing Swoosh modules --- diff --git a/lib/pleroma/config/config_db.ex b/lib/pleroma/config/config_db.ex index 91a1aa0cc..be6688095 100644 --- a/lib/pleroma/config/config_db.ex +++ b/lib/pleroma/config/config_db.ex @@ -416,7 +416,7 @@ defmodule Pleroma.ConfigDB do @spec is_module_name?(String.t()) :: boolean() def is_module_name?(string) do - Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth)\./, string) or + Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth|Swoosh)\./, string) or string in ["Oban", "Ueberauth", "ExSyslogger"] end end diff --git a/test/config/config_db_test.exs b/test/config/config_db_test.exs index 61a0b1d5d..812709fd8 100644 --- a/test/config/config_db_test.exs +++ b/test/config/config_db_test.exs @@ -307,6 +307,15 @@ defmodule Pleroma.ConfigDBTest do assert ConfigDB.from_binary(binary) == Quack.Logger end + test "Swoosh.Adapters modules" do + binary = ConfigDB.transform("Swoosh.Adapters.SMTP") + assert binary == :erlang.term_to_binary(Swoosh.Adapters.SMTP) + assert ConfigDB.from_binary(binary) == Swoosh.Adapters.SMTP + binary = ConfigDB.transform("Swoosh.Adapters.AmazonSES") + assert binary == :erlang.term_to_binary(Swoosh.Adapters.AmazonSES) + assert ConfigDB.from_binary(binary) == Swoosh.Adapters.AmazonSES + end + test "sigil" do binary = ConfigDB.transform("~r[comp[lL][aA][iI][nN]er]") assert binary == :erlang.term_to_binary(~r/comp[lL][aA][iI][nN]er/)