diff options
author | Sergey Suprunenko <suprunenko.s@gmail.com> | 2019-06-01 03:26:45 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-06-01 03:26:45 +0000 |
commit | 2bbc2a801f4f164b9b1beaeedc29a80be2cfbaec (patch) | |
tree | f167af7e8e0756f5388c456ac6ea1d393ec750ee /lib | |
parent | d46cc7896e2434857cfd317709011f57c729877a (diff) | |
download | pleroma-2bbc2a801f4f164b9b1beaeedc29a80be2cfbaec.tar.gz |
Remove all follower collections but actor's from "cc"
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/transmogrifier.ex | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index d8fa2728d..f18ffdee6 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -65,7 +65,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do end end - def fix_explicit_addressing(%{"to" => to, "cc" => cc} = object, explicit_mentions) do + def fix_explicit_addressing( + %{"to" => to, "cc" => cc} = object, + explicit_mentions, + follower_collection + ) do explicit_to = to |> Enum.filter(fn x -> x in explicit_mentions end) @@ -76,6 +80,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do final_cc = (cc ++ explicit_cc) + |> Enum.reject(fn x -> String.ends_with?(x, "/followers") and x != follower_collection end) |> Enum.uniq() object @@ -83,7 +88,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do |> Map.put("cc", final_cc) end - def fix_explicit_addressing(object, _explicit_mentions), do: object + def fix_explicit_addressing(object, _explicit_mentions, _followers_collection), do: object # if directMessage flag is set to true, leave the addressing alone def fix_explicit_addressing(%{"directMessage" => true} = object), do: object @@ -98,8 +103,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do explicit_mentions = explicit_mentions ++ ["https://www.w3.org/ns/activitystreams#Public", follower_collection] - object - |> fix_explicit_addressing(explicit_mentions) + fix_explicit_addressing(object, explicit_mentions, follower_collection) end # if as:Public is addressed, then make sure the followers collection is also addressed @@ -136,7 +140,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do |> fix_addressing_list("cc") |> fix_addressing_list("bto") |> fix_addressing_list("bcc") - |> fix_explicit_addressing + |> fix_explicit_addressing() |> fix_implicit_addressing(followers_collection) end |