Remove useless with in opengraph.ex
authorrinpatch <rinpatch@sdf.org>
Wed, 16 Jan 2019 15:02:46 +0000 (18:02 +0300)
committerrinpatch <rinpatch@sdf.org>
Wed, 16 Jan 2019 15:02:46 +0000 (18:02 +0300)
lib/pleroma/user.ex
lib/pleroma/web/metadata/opengraph.ex

index 96160094abb5f36fa49a8db2e71dc29991cbb061..f6c0f36e42ca5c2122874d4af48baf8d1a747bdf 100644 (file)
@@ -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
index b7c5dc64e8e483fb83c55f661409a06976b317f6..6f88e9bb495c2851386a566d79fb3635ec77eea2 100644 (file)
@@ -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