Mastodon API: Set follower/following counters to 0 when hiding
followers/following is enabled We are already doing that in AP representation, so I think we should do it here as well for consistency.
This commit is contained in:
parent
29807ef6a5
commit
409bcad54b
3 changed files with 37 additions and 2 deletions
|
|
@ -72,6 +72,13 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
image = User.avatar_url(user) |> MediaProxy.url()
|
||||
header = User.banner_url(user) |> MediaProxy.url()
|
||||
user_info = User.get_cached_user_info(user)
|
||||
|
||||
following_count =
|
||||
((!user.info.hide_follows or opts[:for] == user) && user_info.following_count) || 0
|
||||
|
||||
followers_count =
|
||||
((!user.info.hide_followers or opts[:for] == user) && user_info.follower_count) || 0
|
||||
|
||||
bot = (user.info.source_data["type"] || "Person") in ["Application", "Service"]
|
||||
|
||||
emojis =
|
||||
|
|
@ -102,8 +109,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
display_name: display_name,
|
||||
locked: user_info.locked,
|
||||
created_at: Utils.to_masto_date(user.inserted_at),
|
||||
followers_count: user_info.follower_count,
|
||||
following_count: user_info.following_count,
|
||||
followers_count: followers_count,
|
||||
following_count: following_count,
|
||||
statuses_count: user_info.note_count,
|
||||
note: bio || "",
|
||||
url: User.profile_url(user),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue