Formating
authorrinpatch <rinpatch@sdf.org>
Tue, 15 Jan 2019 18:20:27 +0000 (21:20 +0300)
committerrinpatch <rinpatch@sdf.org>
Tue, 15 Jan 2019 18:20:27 +0000 (21:20 +0300)
lib/pleroma/web/metadata/opengraph.ex

index 2eac04ae77699a0421742e4841ec0dbca43d11b1..be7b155d57d7f32e89a19ecb8334fb4de52fc44e 100644 (file)
@@ -9,6 +9,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
   def build_tags(%{activity: activity, user: user}) do
     with truncated_content = scrub_html_and_truncate(activity.data["object"]["content"]) do
       attachments = build_attachments(activity)
+
       [
         {:meta,
          [
@@ -18,10 +19,16 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
         {:meta, [property: "og:url", content: activity.data["id"]], []},
         {:meta, [property: "og:description", content: truncated_content], []},
         {:meta, [property: "twitter:card", content: "summary"], []}
-      ] ++ if attachments == [] 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
+      ] ++
+        if attachments == [] 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
   end