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:
@@ -3,14 +3,19 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
|
||||
alias Mobilizon.Actors.Actor
|
||||
|
||||
def build_tags(%Actor{} = actor) do
|
||||
[
|
||||
tags = [
|
||||
Tag.tag(:meta, property: "og:title", content: Actor.display_name_and_username(actor)),
|
||||
Tag.tag(:meta, property: "og:url", content: actor.url),
|
||||
Tag.tag(:meta, property: "og:description", content: actor.summary),
|
||||
Tag.tag(:meta, property: "og:type", content: "profile"),
|
||||
Tag.tag(:meta, property: "profile:username", content: actor.preferred_username),
|
||||
Tag.tag(:meta, property: "og:image", content: actor.avatar_url),
|
||||
Tag.tag(:meta, property: "twitter:card", content: "summary")
|
||||
]
|
||||
|
||||
if is_nil(actor.avatar) do
|
||||
tags
|
||||
else
|
||||
tags ++ [Tag.tag(:meta, property: "og:image", content: actor.avatar.url)]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,16 +5,28 @@ defimpl Mobilizon.Service.Metadata, for: Mobilizon.Events.Event do
|
||||
alias MobilizonWeb.JsonLD.ObjectView
|
||||
|
||||
def build_tags(%Event{} = event) do
|
||||
[
|
||||
tags = [
|
||||
Tag.tag(:meta, property: "og:title", content: event.title),
|
||||
Tag.tag(:meta, property: "og:url", content: event.url),
|
||||
Tag.tag(:meta, property: "og:description", content: event.description),
|
||||
Tag.tag(:meta, property: "og:type", content: "website"),
|
||||
Tag.tag(:meta, property: "og:image", content: event.thumbnail),
|
||||
Tag.tag(:meta, property: "og:image", content: event.large_image),
|
||||
Tag.tag(:meta, property: "twitter:card", content: "summary_large_image"),
|
||||
~s{<script type="application/ld+json">#{json(event)}</script>} |> HTML.raw()
|
||||
Tag.tag(:meta, property: "og:type", content: "website")
|
||||
]
|
||||
|
||||
tags =
|
||||
if is_nil(event.picture) do
|
||||
tags
|
||||
else
|
||||
tags ++
|
||||
[
|
||||
Tag.tag(:meta, property: "og:image", content: event.picture.file.url)
|
||||
]
|
||||
end
|
||||
|
||||
tags ++
|
||||
[
|
||||
Tag.tag(:meta, property: "twitter:card", content: "summary_large_image"),
|
||||
~s{<script type="application/ld+json">#{json(event)}</script>} |> HTML.raw()
|
||||
]
|
||||
end
|
||||
|
||||
# Insert JSON-LD schema by hand because Tag.content_tag wants to escape it
|
||||
|
||||
Reference in New Issue
Block a user