Do not federate undo->block activities
the :do_not_federate checks were omitted from the undo pipeline, which could lead to them federating. this commit enforces :outgoing_blocks on undos as well - and any existing value of :do_not_federate is preserved, if one exists Akkoma issue 957. [Pleroma: block/unblock test calls use the Pleroma (blocked, blocker) argument order.] (cherry picked from commit eca7ed572b8a10a0235fb1a381eac4803614dee4)
This commit is contained in:
parent
3e9dc477c9
commit
06612c802b
2 changed files with 26 additions and 0 deletions
|
|
@ -78,10 +78,16 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do
|
|||
|> Ecto.Changeset.apply_action(:insert) do
|
||||
object = stringify_keys(object)
|
||||
undone_object = Activity.get_by_ap_id(object["object"])
|
||||
outgoing_blocks = Pleroma.Config.get([:activitypub, :outgoing_blocks])
|
||||
# if we're undoing a block, and do not permit federating that:
|
||||
do_not_federate =
|
||||
Keyword.get(meta, :do_not_federate) ||
|
||||
(Map.get(undone_object.data, "type") == "Block" && !outgoing_blocks)
|
||||
|
||||
meta =
|
||||
meta
|
||||
|> Keyword.put(:object_data, undone_object.data)
|
||||
|> Keyword.put(:do_not_federate, do_not_federate)
|
||||
|
||||
{:ok, object, meta}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue