Make ActivityPub.Publisher aware of the actor change by Transmogrifier

This commit is contained in:
tusooa 2023-03-01 22:42:51 -05:00 committed by Ekaterina Vaartis
commit 58afb15eab
2 changed files with 57 additions and 0 deletions

View file

@ -92,6 +92,19 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
uri = %{path: path} = URI.parse(inbox)
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
{actor, activity, data} =
with {_, false} <- {:actor_changed?, data["actor"] != activity.data["actor"]} do
{orig_actor, activity, data}
else
{:actor_changed?, true} ->
# If prepare_outgoing changes the actor, re-get it from the db
actor = User.get_cached_by_ap_id(data["actor"])
activity = %Activity{activity | actor: actor.ap_id}
{actor, activity, data}
end
param_cc = Map.get(params, :cc, [])