X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fconfig_db.ex;h=b874e0e37a08419ea7b16042fbe866d277a64a77;hb=369581db6db5d2ce5396391d814d903002c7eff6;hp=2c3c0cb5cde485f0a28e1728db12bf8ebf9b6998;hpb=a02eb8839650ecbf8bcad9bd6d346fc280985cae;p=akkoma
diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex
index 2c3c0cb5c..b874e0e37 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