forked from potsda.mn/mobilizon
7086fe8389
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Allow null values for categories for now Signed-off-by: Thomas Citharel <tcit@tcit.fr>
38 lines
1.2 KiB
Elixir
38 lines
1.2 KiB
Elixir
defmodule MobilizonWeb.ActivityPub.ObjectView do
|
|
use MobilizonWeb, :view
|
|
alias Mobilizon.Service.ActivityPub.Utils
|
|
|
|
def render("event.json", %{event: event}) do
|
|
event = %{
|
|
"type" => "Event",
|
|
"actor" => event["actor"],
|
|
"id" => event["id"],
|
|
"name" => event["title"],
|
|
"category" => event["category"],
|
|
"content" => event["summary"],
|
|
"mediaType" => "text/html"
|
|
# "published" => Timex.format!(event.inserted_at, "{ISO:Extended}"),
|
|
# "updated" => Timex.format!(event.updated_at, "{ISO:Extended}")
|
|
}
|
|
|
|
Map.merge(event, Utils.make_json_ld_header())
|
|
end
|
|
|
|
def render("comment.json", %{comment: comment}) do
|
|
comment = %{
|
|
"actor" => comment["actor"],
|
|
"uuid" => comment["uuid"],
|
|
# The activity should have attributedTo, not the comment itself
|
|
# "attributedTo" => comment.attributed_to,
|
|
"type" => "Note",
|
|
"id" => comment["id"],
|
|
"content" => comment["content"],
|
|
"mediaType" => "text/html"
|
|
# "published" => Timex.format!(comment.inserted_at, "{ISO:Extended}"),
|
|
# "updated" => Timex.format!(comment.updated_at, "{ISO:Extended}")
|
|
}
|
|
|
|
Map.merge(comment, Utils.make_json_ld_header())
|
|
end
|
|
end
|