diff options
author | William Pitcock <nenolod@dereferenced.org> | 2018-05-25 09:38:07 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-05-25 09:40:11 +0000 |
commit | f35e6bf75bf81496a5c7192780d9db62ba6b42a9 (patch) | |
tree | 9300da09f0a724afa1f337ea4c7a8dafe68ae2b9 | |
parent | e80d91c64a53a9d64e48a528f40987c5b36f2ca5 (diff) | |
download | pleroma-f35e6bf75bf81496a5c7192780d9db62ba6b42a9.tar.gz pleroma-f35e6bf75bf81496a5c7192780d9db62ba6b42a9.zip |
activitypub transmogrifier: clean up accept/reject handling a bit
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 525b74135..519548788 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -171,7 +171,9 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do with %User{} = followed <- User.get_or_fetch_by_ap_id(actor), {:ok, follow_activity} <- get_follow_activity(follow_object), %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]) do - User.follow(follower, followed) + if not User.following?(follower, followed) do + User.follow(follower, followed) + end {:ok, data} end @@ -182,10 +184,10 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do ) do with %User{} = followed <- User.get_or_fetch_by_ap_id(actor), {:ok, follow_activity} <- get_follow_activity(follow_object), - %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]), - {:ok, follow_activity} <- Utils.fetch_latest_follow(follower, followed), - {:ok, activity} <- ActivityPub.delete(follow_activity, false) do - {:ok, activity} + %User{local: true} = follower <- User.get_cached_by_ap_id(follow_activity["actor"]) do + User.unfollow(follower, followed) + + {:ok, data} end end |