Let pins federate

- save object ids on pin, instead of activity ids
- pins federation
- removed pinned_activities field from the users table
- activityPub endpoint for user pins
- pulling remote users pins
This commit is contained in:
Alexander Strizhakov 2021-02-03 16:09:28 +03:00
commit 3ec1dbd922
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
38 changed files with 1127 additions and 122 deletions

View file

@ -556,6 +556,14 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
end
end
def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do
with :ok <- ObjectValidator.fetch_actor_and_object(data),
%Object{} <- Object.normalize(data["object"], fetch: true),
{:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do
{:ok, activity}
end
end
def handle_incoming(
%{"type" => "Delete"} = data,
_options
@ -1000,6 +1008,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
with %User{local: false} = user <- User.get_cached_by_ap_id(ap_id),
{:ok, data} <- ActivityPub.fetch_and_prepare_user_from_ap_id(ap_id),
{:ok, user} <- update_user(user, data) do
{:ok, _pid} = Task.start(fn -> ActivityPub.pinned_fetch_task(user) end)
TransmogrifierWorker.enqueue("user_upgrade", %{"user_id" => user.id})
{:ok, user}
else