fix Activity.get_by_id

This commit is contained in:
Maksim Pechnikov 2019-09-13 07:12:34 +03:00
commit d8a178274b
2 changed files with 20 additions and 4 deletions

View file

@ -150,11 +150,18 @@ defmodule Pleroma.Activity do
)
end
@spec get_by_id(String.t()) :: Activity.t() | nil
def get_by_id(id) do
Activity
|> where([a], a.id == ^id)
|> restrict_deactivated_users()
|> Repo.one()
case Pleroma.FlakeId.is_flake_id?(id) do
true ->
Activity
|> where([a], a.id == ^id)
|> restrict_deactivated_users()
|> Repo.one()
_ ->
nil
end
end
def get_by_id_with_object(id) do