activitypub transmogrifier: clean up accept/reject handling a bit
This commit is contained in:
parent
e80d91c64a
commit
f35e6bf75b
1 changed files with 7 additions and 5 deletions
|
@ -171,7 +171,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
with %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
|
with %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
|
||||||
{:ok, follow_activity} <- get_follow_activity(follow_object),
|
{:ok, follow_activity} <- get_follow_activity(follow_object),
|
||||||
%User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]) do
|
%User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]) do
|
||||||
|
if not User.following?(follower, followed) do
|
||||||
User.follow(follower, followed)
|
User.follow(follower, followed)
|
||||||
|
end
|
||||||
|
|
||||||
{:ok, data}
|
{:ok, data}
|
||||||
end
|
end
|
||||||
|
@ -182,10 +184,10 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
||||||
) do
|
) do
|
||||||
with %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
|
with %User{} = followed <- User.get_or_fetch_by_ap_id(actor),
|
||||||
{:ok, follow_activity} <- get_follow_activity(follow_object),
|
{:ok, follow_activity} <- get_follow_activity(follow_object),
|
||||||
%User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]),
|
%User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]) do
|
||||||
{:ok, follow_activity} <- Utils.fetch_latest_follow(follower, followed),
|
User.unfollow(follower, followed)
|
||||||
{:ok, activity} <- ActivityPub.delete(follow_activity, false) do
|
|
||||||
{:ok, activity}
|
{:ok, data}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue