X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fconfig_db.ex;h=cb57673e39227aefc4ebac6ff979dbbf4b2bb2e1;hb=959dc6e6fc95b33700fb7e08689afb701b2877f2;hp=2c3c0cb5cde485f0a28e1728db12bf8ebf9b6998;hpb=a02eb8839650ecbf8bcad9bd6d346fc280985cae;p=akkoma
diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex
index 2c3c0cb5c..cb57673e3 100644
--- a/lib/pleroma/config_db.ex
+++ b/lib/pleroma/config_db.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ConfigDB do
@@ -46,13 +46,13 @@ defmodule Pleroma.ConfigDB do
from(c in ConfigDB, where: c.group == ^group) |> Repo.all()
end
- @spec get_all_by_group_and_key(atom() | String.t(), atom() | String.t()) :: [t()]
- def get_all_by_group_and_key(group, key) do
- from(c in ConfigDB, where: c.group == ^group and c.key == ^key) |> Repo.all()
+ @spec get_by_group_and_key(atom() | String.t(), atom() | String.t()) :: t() | nil
+ def get_by_group_and_key(group, key) do
+ get_by_params(%{group: group, key: key})
end
@spec get_by_params(map()) :: ConfigDB.t() | nil
- def get_by_params(params), do: Repo.get_by(ConfigDB, params)
+ def get_by_params(%{group: _, key: _} = params), do: Repo.get_by(ConfigDB, params)
@spec changeset(ConfigDB.t(), map()) :: Changeset.t()
def changeset(config, params \\ %{}) do
@@ -387,6 +387,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