aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Felder <feld@FreeBSD.org>2020-12-14 13:27:42 -0600
committerMark Felder <feld@FreeBSD.org>2020-12-14 13:27:42 -0600
commit6dac2ac71a0005419d1440b5e5daeab3aaabf889 (patch)
treecdfac583bef71b0d2148129a03d3bf66b64bcf32
parentf687befb93a9ad2c3dc61f47bdbb717cb1421ad5 (diff)
downloadpleroma-6dac2ac71a0005419d1440b5e5daeab3aaabf889.tar.gz
Minor refactoring of the logic for hiding followers/following counts.
Field is not nullable anymore, and this is more readable.
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index 3158d09ed..026ae9458 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -187,18 +187,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
header_static = User.banner_url(user) |> MediaProxy.preview_url(static: true)
following_count =
- if !user.hide_follows_count or !user.hide_follows or opts[:for] == user do
- user.following_count || 0
- else
- 0
- end
+ if !user.hide_follows_count or !user.hide_follows or opts[:for] == user,
+ do: user.following_count,
+ else: 0
followers_count =
- if !user.hide_followers_count or !user.hide_followers or opts[:for] == user do
- user.follower_count || 0
- else
- 0
- end
+ if !user.hide_followers_count or !user.hide_followers or opts[:for] == user,
+ do: user.follower_count,
+ else: 0
bot = user.actor_type == "Service"