aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-07-08 15:40:56 +0200
committerlain <lain@soykaf.club>2020-07-08 15:40:56 +0200
commit9dda8b542723afae8dd5493b4082b8524873a14d (patch)
treeff7e9ba1be64a08c3c3993567e2edfdaa89031dd /lib/pleroma/web/common_api
parent172f4aff8ef573c54902dc8fa135d69f50fea47c (diff)
downloadpleroma-9dda8b542723afae8dd5493b4082b8524873a14d.tar.gz
CommonAPI: Switch to pipeline for following.
Diffstat (limited to 'lib/pleroma/web/common_api')
-rw-r--r--lib/pleroma/web/common_api/common_api.ex10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index fd7149079..4d5b0decf 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -101,10 +101,14 @@ defmodule Pleroma.Web.CommonAPI do
def follow(follower, followed) do
timeout = Pleroma.Config.get([:activitypub, :follow_handshake_timeout])
- with {:ok, follower} <- User.maybe_direct_follow(follower, followed),
- {:ok, activity} <- ActivityPub.follow(follower, followed),
+ with {:ok, follow_data, _} <- Builder.follow(follower, followed),
+ {:ok, activity, _} <- Pipeline.common_pipeline(follow_data, local: true),
{:ok, follower, followed} <- User.wait_and_refresh(timeout, follower, followed) do
- {:ok, follower, followed, activity}
+ if activity.data["state"] == "reject" do
+ {:error, :rejected}
+ else
+ {:ok, follower, followed, activity}
+ end
end
end