Merge branch 'develop' into refactor/following-relationships
This commit is contained in:
commit
4ea1a61b00
219 changed files with 3097 additions and 4626 deletions
|
|
@ -518,7 +518,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
|
||||
def handle_incoming(
|
||||
%{"type" => "Accept", "object" => follow_object, "actor" => _actor, "id" => _id} = data,
|
||||
%{"type" => "Accept", "object" => follow_object, "actor" => _actor, "id" => id} = data,
|
||||
_options
|
||||
) do
|
||||
with actor <- Containment.get_actor(data),
|
||||
|
|
@ -532,7 +532,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
type: "Accept",
|
||||
actor: followed,
|
||||
object: follow_activity.data["id"],
|
||||
local: false
|
||||
local: false,
|
||||
activity_id: id
|
||||
})
|
||||
else
|
||||
_e -> :error
|
||||
|
|
@ -540,7 +541,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
end
|
||||
|
||||
def handle_incoming(
|
||||
%{"type" => "Reject", "object" => follow_object, "actor" => _actor, "id" => _id} = data,
|
||||
%{"type" => "Reject", "object" => follow_object, "actor" => _actor, "id" => id} = data,
|
||||
_options
|
||||
) do
|
||||
with actor <- Containment.get_actor(data),
|
||||
|
|
@ -555,7 +556,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
type: "Reject",
|
||||
actor: followed,
|
||||
object: follow_activity.data["id"],
|
||||
local: false
|
||||
local: false,
|
||||
activity_id: id
|
||||
}) do
|
||||
{:ok, activity}
|
||||
else
|
||||
|
|
@ -640,7 +642,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
# an error or a tombstone. This would allow us to verify that a deletion actually took
|
||||
# place.
|
||||
def handle_incoming(
|
||||
%{"type" => "Delete", "object" => object_id, "actor" => actor, "id" => _id} = data,
|
||||
%{"type" => "Delete", "object" => object_id, "actor" => actor, "id" => id} = data,
|
||||
_options
|
||||
) do
|
||||
object_id = Utils.get_ap_id(object_id)
|
||||
|
|
@ -649,7 +651,8 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
{:ok, %User{} = actor} <- User.get_or_fetch_by_ap_id(actor),
|
||||
{:ok, object} <- get_obj_helper(object_id),
|
||||
:ok <- Containment.contain_origin(actor.ap_id, object.data),
|
||||
{:ok, activity} <- ActivityPub.delete(object, false) do
|
||||
{:ok, activity} <-
|
||||
ActivityPub.delete(object, local: false, activity_id: id, actor: actor.ap_id) do
|
||||
{:ok, activity}
|
||||
else
|
||||
nil ->
|
||||
|
|
@ -1053,7 +1056,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
def perform(:user_upgrade, user) do
|
||||
# we pass a fake user so that the followers collection is stripped away
|
||||
old_follower_address = User.ap_followers(%User{nickname: user.nickname})
|
||||
maybe_retire_websub(user.ap_id)
|
||||
|
||||
from(
|
||||
a in Activity,
|
||||
|
|
@ -1095,19 +1097,6 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
|> User.update_and_set_cache()
|
||||
end
|
||||
|
||||
def maybe_retire_websub(ap_id) do
|
||||
# some sanity checks
|
||||
if is_binary(ap_id) && String.length(ap_id) > 8 do
|
||||
q =
|
||||
from(
|
||||
ws in Pleroma.Web.Websub.WebsubClientSubscription,
|
||||
where: fragment("? like ?", ws.topic, ^"#{ap_id}%")
|
||||
)
|
||||
|
||||
Repo.delete_all(q)
|
||||
end
|
||||
end
|
||||
|
||||
def maybe_fix_user_url(%{"url" => url} = data) when is_map(url) do
|
||||
Map.put(data, "url", url["href"])
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue