Add a default profile picture and banner.
[akkoma] / lib / pleroma / web / mastodon_api / views / account_view.ex
index 1d5918988822400da00be251f1948ca660a77f7e..d2a4dd3669fa5fae8f24734fecb1b216136cf879 100644 (file)
@@ -5,19 +5,15 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
   alias Pleroma.Web.CommonAPI.Utils
   alias Pleroma.Web.MediaProxy
 
-  defp image_url(%{"url" => [ %{ "href" => href } | _ ]}), do: href
-  defp image_url(_), do: nil
-
   def render("accounts.json", %{users: users} = opts) do
     render_many(users, AccountView, "account.json", opts)
   end
 
   def render("account.json", %{user: user}) do
     image = User.avatar_url(user) |> MediaProxy.url()
+    header = User.banner_url(user) |> MediaProxy.url()
     user_info = User.user_info(user)
 
-    header = (image_url(user.info["banner"]) || "https://placehold.it/700x335") |> MediaProxy.url()
-
     %{
       id: to_string(user.id),
       username: hd(String.split(user.nickname, "@")),