From: kaniini Date: Sun, 26 Aug 2018 21:06:15 +0000 (+0000) Subject: Merge branch 'develop' into 'feature/relay' X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8;p=akkoma Merge branch 'develop' into 'feature/relay' # Conflicts: # lib/pleroma/web/activity_pub/utils.ex --- 0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8 diff --cc lib/pleroma/web/activity_pub/utils.ex index a2e5c5002,7cdc1656b..0664b5a2e --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@@ -374,21 -360,20 +378,27 @@@ defmodule Pleroma.Web.ActivityPub.Util if activity_id, do: Map.put(data, "id", activity_id), else: data end - def add_announce_to_object(%Activity{data: %{"actor" => actor}}, object) do + def add_announce_to_object( + %Activity{ + data: %{"actor" => actor, "cc" => ["https://www.w3.org/ns/activitystreams#Public"]} + }, + object + ) do - with announcements <- [actor | object.data["announcements"] || []] |> Enum.uniq() do + announcements = + if is_list(object.data["announcements"]), do: object.data["announcements"], else: [] + + with announcements <- [actor | announcements] |> Enum.uniq() do update_element_in_object("announcement", announcements, object) end end + def add_announce_to_object(_, object), do: {:ok, object} + def remove_announce_from_object(%Activity{data: %{"actor" => actor}}, object) do - with announcements <- (object.data["announcements"] || []) |> List.delete(actor) do + announcements = + if is_list(object.data["announcements"]), do: object.data["announcements"], else: [] + + with announcements <- announcements |> List.delete(actor) do update_element_in_object("announcement", announcements, object) end end