Move get_favicon to Pleroma.Instances, use /
[akkoma] / lib / pleroma / web / mastodon_api / views / account_view.ex
index efe835e3c257f8dee9638d10d0cea5607fa76c35..3ee50dfd0a18829ce68eddc6c559a390dfb041cd 100644 (file)
@@ -204,6 +204,15 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
         %{}
       end
 
+    favicon =
+      user
+      |> Map.get(:ap_id, "")
+      |> URI.parse()
+      |> URI.merge("/")
+      |> to_string()
+      |> Pleroma.Instances.get_cached_favicon()
+      |> MediaProxy.url()
+
     %{
       id: to_string(user.id),
       username: username_from_nickname(user.nickname),
@@ -246,7 +255,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
         relationship: relationship,
         skip_thread_containment: user.skip_thread_containment,
         background_image: image_url(user.background) |> MediaProxy.url(),
-        favicon: User.get_cached_favicon(user) |> MediaProxy.url()
+        favicon: favicon
       }
     }
     |> maybe_put_role(user, opts[:for])