Merge branch 'fix-account-auth-check' into 'develop'

Fix authentication check on account rendering when bio is defined

See merge request pleroma/pleroma!4027
This commit is contained in:
Haelwenn 2024-01-05 00:45:29 +00:00
commit 67a5542a73
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1 @@
Fix authentication check on account rendering when bio is defined

View file

@ -194,6 +194,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
end end
defp do_render("show.json", %{user: user} = opts) do defp do_render("show.json", %{user: user} = opts) do
self = opts[:for] == user
user = User.sanitize_html(user, User.html_filter_policy(opts[:for])) user = User.sanitize_html(user, User.html_filter_policy(opts[:for]))
display_name = user.name || user.nickname display_name = user.name || user.nickname
@ -203,12 +205,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
header_static = User.banner_url(user) |> MediaProxy.preview_url(static: true) header_static = User.banner_url(user) |> MediaProxy.preview_url(static: true)
following_count = following_count =
if !user.hide_follows_count or !user.hide_follows or opts[:for] == user, if !user.hide_follows_count or !user.hide_follows or self,
do: user.following_count, do: user.following_count,
else: 0 else: 0
followers_count = followers_count =
if !user.hide_followers_count or !user.hide_followers or opts[:for] == user, if !user.hide_followers_count or !user.hide_followers or self,
do: user.follower_count, do: user.follower_count,
else: 0 else: 0