summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2021-04-13 12:09:18 -0500
committerMark Felder <feld@feld.me>2021-04-13 14:39:31 -0500
commitee53ad4d7705328a5a583680c6f551c4c3bf2302 (patch)
tree2a356e7b19457faa6f17a60384118aea95ec376d
parent905efc57e9f2a96519bf1ac84b56f88d1818cca3 (diff)
Add ConcurrentLimiter to module_name?/1 and apply string_to_elixir_types/1 to search_opts keys during update_or_create/1
-rw-r--r--lib/pleroma/config_db.ex6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex
index b874e0e37..03905c06b 100644
--- a/lib/pleroma/config_db.ex
+++ b/lib/pleroma/config_db.ex
@@ -141,7 +141,9 @@ defmodule Pleroma.ConfigDB do
@spec update_or_create(map()) :: {:ok, ConfigDB.t()} | {:error, Changeset.t()}
def update_or_create(params) do
params = Map.put(params, :value, to_elixir_types(params[:value]))
- search_opts = Map.take(params, [:group, :key])
+
+ search_opts =
+ Map.take(params, [:group, :key]) |> Map.update!(:key, &string_to_elixir_types(&1))
with %ConfigDB{} = config <- ConfigDB.get_by_params(search_opts),
{_, true, config} <- {:partial_update, can_be_partially_updated?(config), config},
@@ -387,6 +389,6 @@ defmodule Pleroma.ConfigDB do
@spec module_name?(String.t()) :: boolean()
def module_name?(string) do
Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth|Swoosh)\./, string) or
- string in ["Oban", "Ueberauth", "ExSyslogger"]
+ string in ["Oban", "Ueberauth", "ExSyslogger", "ConcurrentLimiter"]
end
end