Refactor media upload
Use Upload Media logic from Pleroma Backend changes for picture upload Move AS <-> Model conversion to separate module Front changes Downgrade apollo-client: https://github.com/Akryum/vue-apollo/issues/577 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -8,15 +8,12 @@ defmodule MobilizonWeb.JsonLD.ObjectView do
|
||||
|
||||
def render("event.json", %{event: %Event{} = event}) do
|
||||
# TODO: event.description is actually markdown!
|
||||
|
||||
json_ld = %{
|
||||
"@context" => "https://schema.org",
|
||||
"@type" => "Event",
|
||||
"name" => event.title,
|
||||
"description" => event.description,
|
||||
"image" => [
|
||||
event.thumbnail,
|
||||
event.large_image
|
||||
],
|
||||
"performer" => %{
|
||||
"@type" =>
|
||||
if(event.organizer_actor.type == :Group, do: "PerformingGroup", else: "Person"),
|
||||
@@ -25,6 +22,15 @@ defmodule MobilizonWeb.JsonLD.ObjectView do
|
||||
"location" => render_one(event.physical_address, ObjectView, "place.json", as: :address)
|
||||
}
|
||||
|
||||
json_ld =
|
||||
if event.picture do
|
||||
Map.put(json_ld, "image", [
|
||||
event.picture.file.url
|
||||
])
|
||||
else
|
||||
json_ld
|
||||
end
|
||||
|
||||
json_ld =
|
||||
if event.begins_on,
|
||||
do: Map.put(json_ld, "startDate", DateTime.to_iso8601(event.begins_on)),
|
||||
|
||||
@@ -44,7 +44,7 @@ defmodule MobilizonWeb.PageView do
|
||||
end
|
||||
|
||||
def render("event.activity-json", %{conn: %{assigns: %{object: event}}}) do
|
||||
event = Utils.make_event_data(event)
|
||||
event = Mobilizon.Service.ActivityPub.Converters.Event.model_to_as(event)
|
||||
{:ok, html, []} = Earmark.as_html(event["summary"])
|
||||
|
||||
%{
|
||||
@@ -66,7 +66,7 @@ defmodule MobilizonWeb.PageView do
|
||||
end
|
||||
|
||||
def render("comment.activity-json", %{conn: %{assigns: %{object: comment}}}) do
|
||||
comment = Utils.make_comment_data(comment)
|
||||
comment = Mobilizon.Service.ActivityPub.Converters.Comment.model_to_as(comment)
|
||||
|
||||
%{
|
||||
"actor" => comment["actor"],
|
||||
|
||||
Reference in New Issue
Block a user