diff options
author | rinpatch <rinpatch@sdf.org> | 2019-01-16 18:02:46 +0300 |
---|---|---|
committer | rinpatch <rinpatch@sdf.org> | 2019-01-16 18:02:46 +0300 |
commit | bb43f4cee94dfd6a71105fb31f10c4b0188a4bf2 (patch) | |
tree | 3514c80f8aedb42a065ff14cc14130c5940feba7 /lib | |
parent | 9a90b5d91a7a5a40d0e90d3112faea65b6e332ad (diff) | |
download | pleroma-bb43f4cee94dfd6a71105fb31f10c4b0188a4bf2.tar.gz |
Remove useless with in opengraph.ex
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/metadata/opengraph.ex | 42 |
2 files changed, 21 insertions, 23 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 96160094a..f6c0f36e4 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -462,7 +462,7 @@ defmodule Pleroma.User do end 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 def get_by_nickname(nickname) do diff --git a/lib/pleroma/web/metadata/opengraph.ex b/lib/pleroma/web/metadata/opengraph.ex index b7c5dc64e..6f88e9bb4 100644 --- a/lib/pleroma/web/metadata/opengraph.ex +++ b/lib/pleroma/web/metadata/opengraph.ex @@ -10,29 +10,27 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do @impl Provider 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) - [ - {:meta, - [ - property: "og:title", - content: user_name_string(user) - ], []}, - {:meta, [property: "og:url", content: activity.data["id"]], []}, - {:meta, [property: "og:description", content: truncated_content], []} - ] ++ - if attachments == [] or - Enum.any?(activity.data["object"]["tag"], fn tag -> tag == "nsfw" end) do - [ - {:meta, [property: "og:image", content: attachment_url(User.avatar_url(user))], []}, - {:meta, [property: "og:image:width", content: 120], []}, - {:meta, [property: "og:image:height", content: 120], []} - ] - else - attachments - end - end + [ + {:meta, + [ + property: "og:title", + content: user_name_string(user) + ], []}, + {:meta, [property: "og:url", content: activity.data["id"]], []}, + {:meta, [property: "og:description", content: scrub_html_and_truncate(activity)], []} + ] ++ + if attachments == [] or + Enum.any?(activity.data["object"]["tag"], fn tag -> tag == "nsfw" end) do + [ + {:meta, [property: "og:image", content: attachment_url(User.avatar_url(user))], []}, + {:meta, [property: "og:image:width", content: 120], []}, + {:meta, [property: "og:image:height", content: 120], []} + ] + else + attachments + end end @impl Provider |