Add Activity Pub endpoints cache

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-03-01 18:30:46 +01:00
parent b3a3001e90
commit a3ffc08e57
6 changed files with 104 additions and 43 deletions

View File

@@ -283,16 +283,20 @@ defmodule Mobilizon.Service.ActivityPub.Utils do
@spec make_event_data(Event.t(), list(String.t())) :: map()
def make_event_data(
%Event{title: title, organizer_actor: actor, uuid: uuid},
%Event{} = event,
to \\ ["https://www.w3.org/ns/activitystreams#Public"]
) do
%{
"type" => "Event",
"to" => to,
"title" => title,
"actor" => actor.url,
"uuid" => uuid,
"id" => "#{MobilizonWeb.Endpoint.url()}/events/#{uuid}"
"title" => event.title,
"actor" => event.organizer_actor.url,
"uuid" => event.uuid,
"category" => event.category,
"summary" => event.description,
"publish_at" => (event.publish_at || event.inserted_at) |> DateTime.to_iso8601(),
"updated_at" => event.updated_at |> DateTime.to_iso8601(),
"id" => "#{MobilizonWeb.Endpoint.url()}/events/#{event.uuid}"
}
end