Formating

This commit is contained in:
rinpatch 2019-01-15 21:20:27 +03:00
parent 410fd9d774
commit e8eecd61b4
1 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
def build_tags(%{activity: activity, user: user}) do def build_tags(%{activity: activity, user: user}) do
with truncated_content = scrub_html_and_truncate(activity.data["object"]["content"]) do with truncated_content = scrub_html_and_truncate(activity.data["object"]["content"]) do
attachments = build_attachments(activity) attachments = build_attachments(activity)
[ [
{:meta, {:meta,
[ [
@ -18,10 +19,16 @@ def build_tags(%{activity: activity, user: user}) do
{:meta, [property: "og:url", content: activity.data["id"]], []}, {:meta, [property: "og:url", content: activity.data["id"]], []},
{:meta, [property: "og:description", content: truncated_content], []}, {:meta, [property: "og:description", content: truncated_content], []},
{:meta, [property: "twitter:card", content: "summary"], []} {:meta, [property: "twitter:card", content: "summary"], []}
] ++ if attachments == [] do [ ] ++
if attachments == [] do
[
{:meta, [property: "og:image", content: attachment_url(User.avatar_url(user))], []}, {:meta, [property: "og:image", content: attachment_url(User.avatar_url(user))], []},
{:meta, [property: "og:image:width", content: 120], []}, {:meta, [property: "og:image:width", content: 120], []},
{:meta, [property: "og:image:height", content: 120], []} ] else attachments end {:meta, [property: "og:image:height", content: 120], []}
]
else
attachments
end
end end
end end