Merge branch 'chore/refactor-hide-counts' into 'develop'

Minor refactoring of the logic for hiding followers/following counts.

See merge request pleroma/pleroma!3202
This commit is contained in:
lain 2020-12-15 11:32:49 +00:00
commit b8c3dfc78c

View file

@ -187,18 +187,14 @@ defp do_render("show.json", %{user: user} = opts) 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 do if !user.hide_follows_count or !user.hide_follows or opts[:for] == user,
user.following_count || 0 do: user.following_count,
else else: 0
0
end
followers_count = followers_count =
if !user.hide_followers_count or !user.hide_followers or opts[:for] == user do if !user.hide_followers_count or !user.hide_followers or opts[:for] == user,
user.follower_count || 0 do: user.follower_count,
else else: 0
0
end
bot = user.actor_type == "Service" bot = user.actor_type == "Service"