X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Faccount_view.ex;h=7eb4e86fec624ed2d10a43def5d9c04711152ade;hb=85446cc30c97a326d90b4ef719ba2e54c2ad423f;hp=b929d5a036af2dbbd59d588f84ce33f27b8dce43;hpb=6f5f7af607518b6f67df68bab9bf76142e9a622c;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 b929d5a03..7eb4e86fe 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -39,11 +39,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do @doc """ Renders specified user account. - :force option skips visibility check and renders any user (local or remote) + :skip_visibility_check option skips visibility check and renders any user (local or remote) regardless of [:pleroma, :restrict_unauthenticated] setting. :for option specifies the requester and can be a User record or nil. + Only use `user: user, for: user` when `user` is the actual requester of own profile. """ - def render("show.json", %{user: _user, force: true} = opts) do + def render("show.json", %{user: _user, skip_visibility_check: true} = opts) do do_render("show.json", opts) end @@ -56,7 +57,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do end def render("show.json", _) do - raise "In order to prevent account accessibility issues, :force or :for option is required." + raise "In order to prevent account accessibility issues, " <> + ":skip_visibility_check or :for option is required." end def render("mention.json", %{user: user}) do @@ -179,8 +181,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do user = User.sanitize_html(user, User.html_filter_policy(opts[:for])) display_name = user.name || user.nickname - image = User.avatar_url(user) |> MediaProxy.url() + avatar = User.avatar_url(user) |> MediaProxy.url() + avatar_static = User.avatar_url(user) |> MediaProxy.preview_url() header = User.banner_url(user) |> MediaProxy.url() + header_static = User.banner_url(user) |> MediaProxy.preview_url() following_count = if !user.hide_follows_count or !user.hide_follows or opts[:for] == user do @@ -243,12 +247,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do followers_count: followers_count, following_count: following_count, statuses_count: user.note_count, - note: user.bio || "", + note: user.bio, url: user.uri || user.ap_id, - avatar: image, - avatar_static: image, + avatar: avatar, + avatar_static: avatar_static, header: header, - header_static: header, + header_static: header_static, emojis: emojis, fields: user.fields, bot: bot,