logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 5846e7d5f6b91ab63270f2104543d874589d39ca
parent 0ecd6ba35e868eac296b013f743d82a120dd68db
Author: marcin mikołajczak <git@mkljczk.pl>
Date:   Wed,  1 Jun 2022 16:03:22 +0200

Use Repo.exists?

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>

Diffstat:

Mlib/pleroma/rule.ex5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/pleroma/rule.ex b/lib/pleroma/rule.ex @@ -37,7 +37,10 @@ defmodule Pleroma.Rule do def get(id), do: Repo.get(__MODULE__, id) - def exists?(id), do: not is_nil(get(id)) + def exists?(id) do + from(r in __MODULE__, where: r.id == ^id) + |> Repo.exists?() + end def create(params) do {:ok, rule} =