More tests
This commit is contained in:
@@ -134,10 +134,17 @@ defmodule EventosWeb.ActivityPub.ActorView do
|
||||
else
|
||||
"Announce"
|
||||
end,
|
||||
"actor" => activity.data.organizer_actor.url,
|
||||
"actor" => activity.actor,
|
||||
"published" => Timex.now(),
|
||||
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"object" => render_one(activity.data, ObjectView, "event.json", as: :event)
|
||||
"object" =>
|
||||
case activity.type do
|
||||
:Event ->
|
||||
render_one(activity.data, ObjectView, "event.json", as: :event)
|
||||
|
||||
:Comment ->
|
||||
render_one(activity.data, ObjectView, "note.json", as: :note)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -32,6 +32,19 @@ defmodule EventosWeb.ActivityPub.ObjectView do
|
||||
Map.merge(event, @base)
|
||||
end
|
||||
|
||||
def render("note.json", %{note: note}) do
|
||||
event = %{
|
||||
"type" => "Note",
|
||||
"id" => note.url,
|
||||
"content" => note.text,
|
||||
"mediaType" => "text/markdown",
|
||||
"published" => Timex.format!(note.inserted_at, "{ISO:Extended}"),
|
||||
"updated" => Timex.format!(note.updated_at, "{ISO:Extended}")
|
||||
}
|
||||
|
||||
Map.merge(event, @base)
|
||||
end
|
||||
|
||||
def render("category.json", %{category: category}) do
|
||||
%{"title" => category.title}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user