X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Faccount_view.ex;h=d2a4dd3669fa5fae8f24734fecb1b216136cf879;hb=ad0ab3a57bc5591806cae0201d8077ffb10b6634;hp=68d930a68c1f0040f35e2bc0ec90a07234f746d8;hpb=d659fcc1957600e7937af7e9a456af8bc452bbd8;p=akkoma diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 68d930a68..d2a4dd366 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -3,22 +3,19 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do alias Pleroma.User alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.CommonAPI.Utils - - defp image_url(%{"url" => [ %{ "href" => href } | t ]}), do: href - defp image_url(_), do: nil + alias Pleroma.Web.MediaProxy 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) + 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" - %{ - id: user.id, + id: to_string(user.id), username: hd(String.split(user.nickname, "@")), acct: user.nickname, display_name: user.name, @@ -32,13 +29,18 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do avatar: image, avatar_static: image, header: header, - header_static: header + header_static: header, + source: %{ + note: "", + privacy: "public", + sensitive: "false" + } } end def render("mention.json", %{user: user}) do %{ - id: user.id, + id: to_string(user.id), acct: user.nickname, username: hd(String.split(user.nickname, "@")), url: user.ap_id @@ -47,10 +49,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do def render("relationship.json", %{user: user, target: target}) do %{ - id: target.id, + id: to_string(target.id), following: User.following?(user, target), followed_by: User.following?(target, user), - blocking: false, + blocking: User.blocks?(user, target), muting: false, requested: false, domain_blocking: false