mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-18 19:14:03 +00:00
Add ConcurrentLimiter to module_name?/1 and apply string_to_elixir_types/1 to search_opts keys during update_or_create/1
This commit is contained in:
parent
905efc57e9
commit
ee53ad4d77
|
@ -141,7 +141,9 @@ defp deep_merge(_key, value1, value2) 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 @@ defp find_valid_delimiter([delimiter | others], pattern, regex_delimiter) 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
|
||||
|
|
Loading…
Reference in a new issue