Fix events & posts not being sent to group followers
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -94,18 +94,13 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
|
||||
to =
|
||||
if event.visibility == :public,
|
||||
do: ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
else: [event.organizer_actor.followers_url]
|
||||
else: [attributed_to_or_default(event).followers_url]
|
||||
|
||||
%{
|
||||
"type" => "Event",
|
||||
"to" => to,
|
||||
"cc" => [],
|
||||
"attributedTo" =>
|
||||
if(is_nil(event.attributed_to) or not Ecto.assoc_loaded?(event.attributed_to),
|
||||
do: nil,
|
||||
else: event.attributed_to.url
|
||||
) ||
|
||||
event.organizer_actor.url,
|
||||
"attributedTo" => attributed_to_or_default(event).url,
|
||||
"name" => event.title,
|
||||
"actor" =>
|
||||
if(Ecto.assoc_loaded?(event.organizer_actor), do: event.organizer_actor.url, else: nil),
|
||||
@@ -135,6 +130,15 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
|
||||
|> maybe_add_inline_media(event)
|
||||
end
|
||||
|
||||
@spec attributed_to_or_default(Event.t()) :: Actor.t()
|
||||
defp attributed_to_or_default(event) do
|
||||
if(is_nil(event.attributed_to) or not Ecto.assoc_loaded?(event.attributed_to),
|
||||
do: nil,
|
||||
else: event.attributed_to
|
||||
) ||
|
||||
event.organizer_actor
|
||||
end
|
||||
|
||||
# Get only elements that we have in EventOptions
|
||||
@spec get_options(map) :: map
|
||||
defp get_options(object) do
|
||||
|
||||
Reference in New Issue
Block a user