Adjust delete activity audience to match the deleted object

This commit is contained in:
Karen Konou 2019-03-07 12:26:03 +01:00
parent 6a69ece437
commit c2faae70df

View file

@ -309,16 +309,13 @@ def unfollow(follower, followed, activity_id \\ nil, local \\ true) do
def delete(%Object{data: %{"id" => id, "actor" => actor}} = object, local \\ true) do def delete(%Object{data: %{"id" => id, "actor" => actor}} = object, local \\ true) do
user = User.get_cached_by_ap_id(actor) user = User.get_cached_by_ap_id(actor)
to = object.data["to"] || [] ++ object.data["cc"] || []
to =
object.data["to"] || [] ++ object.data["cc"] ||
[] ++ [user.follower_address, "https://www.w3.org/ns/activitystreams#Public"]
data = %{ data = %{
"type" => "Delete", "type" => "Delete",
"actor" => actor, "actor" => actor,
"object" => id, "object" => id,
"to" => Enum.uniq(to) "to" => to
} }
with {:ok, _} <- Object.delete(object), with {:ok, _} <- Object.delete(object),