Make sure activity recipient can't be nil
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
888d2ef4b8
commit
3b8b150d48
|
@ -110,6 +110,9 @@ defmodule Mobilizon.Federation.ActivityPub.Publisher do
|
||||||
@spec convert_followers_in_recipients(list(String.t())) :: {list(String.t()), list(String.t())}
|
@spec convert_followers_in_recipients(list(String.t())) :: {list(String.t()), list(String.t())}
|
||||||
defp convert_followers_in_recipients(recipients) do
|
defp convert_followers_in_recipients(recipients) do
|
||||||
Enum.reduce(recipients, {recipients, []}, fn recipient, {recipients, follower_actors} = acc ->
|
Enum.reduce(recipients, {recipients, []}, fn recipient, {recipients, follower_actors} = acc ->
|
||||||
|
if is_nil(recipient) do
|
||||||
|
acc
|
||||||
|
else
|
||||||
case Actors.get_actor_by_followers_url(recipient) do
|
case Actors.get_actor_by_followers_url(recipient) do
|
||||||
%Actor{} = group ->
|
%Actor{} = group ->
|
||||||
{Enum.filter(recipients, fn recipient -> recipient != group.followers_url end),
|
{Enum.filter(recipients, fn recipient -> recipient != group.followers_url end),
|
||||||
|
@ -118,6 +121,7 @@ defmodule Mobilizon.Federation.ActivityPub.Publisher do
|
||||||
nil ->
|
nil ->
|
||||||
acc
|
acc
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -128,6 +132,9 @@ defmodule Mobilizon.Federation.ActivityPub.Publisher do
|
||||||
@spec convert_members_in_recipients(list(String.t())) :: {list(String.t()), list(Actor.t())}
|
@spec convert_members_in_recipients(list(String.t())) :: {list(String.t()), list(Actor.t())}
|
||||||
defp convert_members_in_recipients(recipients) do
|
defp convert_members_in_recipients(recipients) do
|
||||||
Enum.reduce(recipients, {recipients, []}, fn recipient, {recipients, member_actors} = acc ->
|
Enum.reduce(recipients, {recipients, []}, fn recipient, {recipients, member_actors} = acc ->
|
||||||
|
if is_nil(recipient) do
|
||||||
|
acc
|
||||||
|
else
|
||||||
case Actors.get_group_by_members_url(recipient) do
|
case Actors.get_group_by_members_url(recipient) do
|
||||||
# If the group is local just add external members
|
# If the group is local just add external members
|
||||||
%Actor{domain: domain} = group when is_nil(domain) ->
|
%Actor{domain: domain} = group when is_nil(domain) ->
|
||||||
|
@ -142,6 +149,7 @@ defmodule Mobilizon.Federation.ActivityPub.Publisher do
|
||||||
_ ->
|
_ ->
|
||||||
acc
|
acc
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue