fix(back): only try to insert activities for groups

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2023-09-05 15:35:04 +02:00
parent b86928b6b3
commit cfc984345e
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -22,6 +22,10 @@ defmodule Mobilizon.Service.Activity.Participant do
event = Events.get_event!(event_id)
subject = Keyword.fetch!(options, :subject)
if is_nil(event.attributed_to_id) do
# No activity for non-group events
{:ok, nil}
else
ActivityBuilder.enqueue(:build_activity, %{
"type" => "event",
"subject" => subject,
@ -37,6 +41,7 @@ defmodule Mobilizon.Service.Activity.Participant do
"inserted_at" => DateTime.utc_now()
})
end
end
@impl Activity
def insert_activity(_, _), do: {:ok, nil}