aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-08-11 17:43:16 +0200
committerlain <lain@soykaf.club>2020-08-11 17:43:16 +0200
commit25bfee0d12d6ee096bba169089cc57c91efd7bc3 (patch)
tree7d27c75f71ed4feedf170d05508f5fb5fbbcbb51 /lib
parentf988d82e463d2c08fa2cc22dc6ee733ee8668671 (diff)
downloadpleroma-25bfee0d12d6ee096bba169089cc57c91efd7bc3.tar.gz
ActivityPub: Remove ActivityPub.accept
Switch to the pipeline in CommonAPI and SideEffects
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex5
-rw-r--r--lib/pleroma/web/activity_pub/side_effects.ex15
-rw-r--r--lib/pleroma/web/common_api/common_api.ex13
3 files changed, 5 insertions, 28 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index fe62673dc..6dd94119b 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -285,11 +285,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
end
- @spec accept(map()) :: {:ok, Activity.t()} | {:error, any()}
- def accept(params) do
- accept_or_reject("Accept", params)
- end
-
@spec reject(map()) :: {:ok, Activity.t()} | {:error, any()}
def reject(params) do
accept_or_reject("Reject", params)
diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex
index 3ba7eaf9e..4228041e7 100644
--- a/lib/pleroma/web/activity_pub/side_effects.ex
+++ b/lib/pleroma/web/activity_pub/side_effects.ex
@@ -16,6 +16,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.Pipeline
alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.Push
@@ -72,18 +73,8 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
{_, {:ok, _}, _, _} <-
{:following, User.follow(follower, followed, :follow_pending), follower, followed} do
if followed.local && !followed.locked do
- Utils.update_follow_state_for_all(object, "accept")
- FollowingRelationship.update(follower, followed, :follow_accept)
- User.update_follower_count(followed)
- User.update_following_count(follower)
-
- %{
- to: [following_user],
- actor: followed,
- object: follow_id,
- local: true
- }
- |> ActivityPub.accept()
+ {:ok, accept_data, _} = Builder.accept(followed, object)
+ {:ok, _activity, _} = Pipeline.common_pipeline(accept_data, local: true)
end
else
{:following, {:error, _}, follower, followed} ->
diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex
index c08e0ffeb..7b08c19a8 100644
--- a/lib/pleroma/web/common_api/common_api.ex
+++ b/lib/pleroma/web/common_api/common_api.ex
@@ -122,17 +122,8 @@ defmodule Pleroma.Web.CommonAPI do
def accept_follow_request(follower, followed) do
with %Activity{} = follow_activity <- Utils.fetch_latest_follow(follower, followed),
- {:ok, follower} <- User.follow(follower, followed),
- {:ok, follow_activity} <- Utils.update_follow_state_for_all(follow_activity, "accept"),
- {:ok, _relationship} <- FollowingRelationship.update(follower, followed, :follow_accept),
- {:ok, _activity} <-
- ActivityPub.accept(%{
- to: [follower.ap_id],
- actor: followed,
- object: follow_activity.data["id"],
- type: "Accept"
- }) do
- Notification.update_notification_type(followed, follow_activity)
+ {:ok, accept_data, _} <- Builder.accept(followed, follow_activity),
+ {:ok, _activity, _} <- Pipeline.common_pipeline(accept_data, local: true) do
{:ok, follower}
end
end