Merge branch 'use-media-proxy-in-suggestions-api' into 'develop'

use media proxy for the suggestions api

See merge request pleroma/pleroma!305
This commit is contained in:
kaniini 2018-08-30 23:06:30 +00:00
commit e838969495

View file

@ -7,6 +7,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.ActivityPub.Utils
alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI
alias Pleroma.Web.OAuth.{Authorization, Token, App} alias Pleroma.Web.OAuth.{Authorization, Token, App}
alias Pleroma.Web.MediaProxy
alias Comeonin.Pbkdf2 alias Comeonin.Pbkdf2
import Ecto.Query import Ecto.Query
require Logger require Logger
@ -1130,6 +1131,12 @@ def suggestions(%{assigns: %{user: user}} = conn, _) do
end end
) )
end) end)
|> Enum.map(fn x ->
Map.put(x, "avatar", MediaProxy.url(x["avatar"]))
end)
|> Enum.map(fn x ->
Map.put(x, "avatar_static", MediaProxy.url(x["avatar_static"]))
end)
conn conn
|> json(data2) |> json(data2)