aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index f0b157962..c1786a322 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -12,8 +12,16 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
alias Pleroma.Web.MastodonAPI.AccountView
alias Pleroma.Web.MediaProxy
+ # Default behaviour for account view is to include embedded relationships
+ # (e.g. when accounts are rendered on their own [e.g. a list of search results], not as
+ # embedded content in notifications / statuses).
+ # This option must be explicitly set to false when rendering accounts as embedded content.
+ defp initialize_skip_relationships(opts) do
+ Map.merge(%{skip_relationships: false}, opts)
+ end
+
def render("index.json", %{users: users} = opts) do
- opts = Map.merge(%{skip_relationships: false}, opts)
+ opts = initialize_skip_relationships(opts)
reading_user = opts[:for]
@@ -161,7 +169,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
end
defp do_render("show.json", %{user: user} = opts) do
- opts = Map.merge(%{skip_relationships: false}, opts)
+ opts = initialize_skip_relationships(opts)
user = User.sanitize_html(user, User.html_filter_policy(opts[:for]))
display_name = user.name || user.nickname