Fix crash when trying to notify activities not from groups

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-30 10:13:57 +02:00
parent cc806265cc
commit f5aa7ffa74
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -33,7 +33,7 @@ defmodule Mobilizon.Service.Workers.ActivityBuilder do
end
@spec users_to_notify(Activity.t()) :: list(User.t())
defp users_to_notify(%Activity{group: %Actor{} = group, author_id: author_id}) do
defp users_to_notify(%Activity{group: %Actor{type: :Group} = group, author_id: author_id}) do
group
|> Actors.list_internal_actors_members_for_group([
:creator,
@ -47,4 +47,6 @@ defmodule Mobilizon.Service.Workers.ActivityBuilder do
|> Enum.uniq()
|> Enum.map(&Users.get_user_with_settings!/1)
end
defp users_to_notify(_), do: []
end