Make Categories a predefined list
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Allow null values for categories for now Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
defmodule MobilizonWeb.ActivityPub.ObjectView do
|
||||
use MobilizonWeb, :view
|
||||
alias MobilizonWeb.ActivityPub.ObjectView
|
||||
alias Mobilizon.Service.ActivityPub.Utils
|
||||
|
||||
def render("event.json", %{event: event}) do
|
||||
@@ -9,7 +8,7 @@ defmodule MobilizonWeb.ActivityPub.ObjectView do
|
||||
"actor" => event["actor"],
|
||||
"id" => event["id"],
|
||||
"name" => event["title"],
|
||||
"category" => render_one(event["category"], ObjectView, "category.json", as: :category),
|
||||
"category" => event["category"],
|
||||
"content" => event["summary"],
|
||||
"mediaType" => "text/html"
|
||||
# "published" => Timex.format!(event.inserted_at, "{ISO:Extended}"),
|
||||
@@ -35,15 +34,4 @@ defmodule MobilizonWeb.ActivityPub.ObjectView do
|
||||
|
||||
Map.merge(comment, Utils.make_json_ld_header())
|
||||
end
|
||||
|
||||
def render("category.json", %{category: category}) when not is_nil(category) do
|
||||
%{
|
||||
"identifier" => category.id,
|
||||
"name" => category.title
|
||||
}
|
||||
end
|
||||
|
||||
def render("category.json", %{category: _category}) do
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user