mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Transmogrifier: Use Containment.get_actor to get actors.
This commit is contained in:
parent
3da65292b3
commit
c30cc039e4
2 changed files with 4 additions and 6 deletions
|
@ -230,8 +230,4 @@ defmodule Pleroma.Object do
|
||||||
_ -> :noop
|
_ -> :noop
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_ap_id(%{"id" => id}), do: id
|
|
||||||
def get_ap_id(id) when is_binary(id), do: id
|
|
||||||
def get_ap_id(_), do: {:error, "Object is not a string and has no id."}
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -464,8 +464,10 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
%{"type" => "Follow", "object" => followed, "actor" => follower, "id" => id} = data,
|
%{"type" => "Follow", "object" => followed, "actor" => follower, "id" => id} = data,
|
||||||
_options
|
_options
|
||||||
) do
|
) do
|
||||||
with %User{local: true} = followed <- User.get_cached_by_ap_id(Object.get_ap_id(followed)),
|
with %User{local: true} = followed <-
|
||||||
{:ok, %User{} = follower} <- User.get_or_fetch_by_ap_id(Object.get_ap_id(follower)),
|
User.get_cached_by_ap_id(Containment.get_actor(%{"actor" => followed})),
|
||||||
|
{:ok, %User{} = follower} <-
|
||||||
|
User.get_or_fetch_by_ap_id(Containment.get_actor(%{"actor" => follower})),
|
||||||
{:ok, activity} <- ActivityPub.follow(follower, followed, id, false) do
|
{:ok, activity} <- ActivityPub.follow(follower, followed, id, false) do
|
||||||
with deny_follow_blocked <- Pleroma.Config.get([:user, :deny_follow_blocked]),
|
with deny_follow_blocked <- Pleroma.Config.get([:user, :deny_follow_blocked]),
|
||||||
{_, false} <- {:user_blocked, User.blocks?(followed, follower) && deny_follow_blocked},
|
{_, false} <- {:user_blocked, User.blocks?(followed, follower) && deny_follow_blocked},
|
||||||
|
|
Loading…
Reference in a new issue