Remove useless with in opengraph.ex

This commit is contained in:
rinpatch 2019-01-16 18:02:46 +03:00
parent 9a90b5d91a
commit bb43f4cee9
2 changed files with 21 additions and 23 deletions

View file

@ -462,7 +462,7 @@ def get_cached_by_nickname(nickname) do
end end
def get_cached_by_nickname_or_id(nickname_or_id) do def get_cached_by_nickname_or_id(nickname_or_id) do
get_cached_by_id(maybe_id) || get_cached_by_nickname(nickname_or_id) get_cached_by_id(nickname_or_id) || get_cached_by_nickname(nickname_or_id)
end end
def get_by_nickname(nickname) do def get_by_nickname(nickname) do

View file

@ -10,7 +10,6 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
@impl Provider @impl Provider
def build_tags(%{activity: activity, user: user}) do def build_tags(%{activity: activity, user: user}) do
with truncated_content = scrub_html_and_truncate(activity) do
attachments = build_attachments(activity) attachments = build_attachments(activity)
[ [
@ -20,7 +19,7 @@ def build_tags(%{activity: activity, user: user}) do
content: user_name_string(user) content: user_name_string(user)
], []}, ], []},
{: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: scrub_html_and_truncate(activity)], []}
] ++ ] ++
if attachments == [] or if attachments == [] or
Enum.any?(activity.data["object"]["tag"], fn tag -> tag == "nsfw" end) do Enum.any?(activity.data["object"]["tag"], fn tag -> tag == "nsfw" end) do
@ -33,7 +32,6 @@ def build_tags(%{activity: activity, user: user}) do
attachments attachments
end end
end end
end
@impl Provider @impl Provider
def build_tags(%{user: user}) do def build_tags(%{user: user}) do