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,20 +22,25 @@ defmodule Mobilizon.Service.Activity.Participant do
event = Events.get_event!(event_id) event = Events.get_event!(event_id)
subject = Keyword.fetch!(options, :subject) subject = Keyword.fetch!(options, :subject)
ActivityBuilder.enqueue(:build_activity, %{ if is_nil(event.attributed_to_id) do
"type" => "event", # No activity for non-group events
"subject" => subject, {:ok, nil}
"subject_params" => %{ else
actor_name: Actor.display_name(actor), ActivityBuilder.enqueue(:build_activity, %{
event_title: event.title, "type" => "event",
event_uuid: event.uuid "subject" => subject,
}, "subject_params" => %{
"group_id" => event.attributed_to_id, actor_name: Actor.display_name(actor),
"author_id" => actor.id, event_title: event.title,
"object_type" => "participant", event_uuid: event.uuid
"object_id" => participant_id, },
"inserted_at" => DateTime.utc_now() "group_id" => event.attributed_to_id,
}) "author_id" => actor.id,
"object_type" => "participant",
"object_id" => participant_id,
"inserted_at" => DateTime.utc_now()
})
end
end end
@impl Activity @impl Activity