From: lain Date: Wed, 27 Nov 2019 13:48:28 +0000 (+0100) Subject: Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into bugfix/1442-dont... X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=50b152766f3be98bda3c630c3e451e6411053900;p=akkoma Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into bugfix/1442-dont-return-nil-for-following-count --- 50b152766f3be98bda3c630c3e451e6411053900 diff --cc lib/pleroma/web/mastodon_api/views/account_view.ex index e30fed610,7f50f3aa6..1068f8823 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@@ -74,15 -74,14 +74,14 @@@ defmodule Pleroma.Web.MastodonAPI.Accou following_count = if !user.hide_follows_count or !user.hide_follows or opts[:for] == user do - user_info.following_count - user.following_count ++ user.following_count || 0 else 0 end followers_count = if !user.hide_followers_count or !user.hide_followers or opts[:for] == user do - user_info.follower_count - user.follower_count ++ user.follower_count || 0 else 0 end diff --cc test/web/mastodon_api/views/account_view_test.exs index af88841ed,15bfcbb78..d147079ab --- a/test/web/mastodon_api/views/account_view_test.exs +++ b/test/web/mastodon_api/views/account_view_test.exs @@@ -374,6 -375,6 +375,14 @@@ defmodule Pleroma.Web.MastodonAPI.Accou refute result.display_name == " username " end ++ test "never display nil user follow counts" do ++ user = insert(:user, following_count: 0, follower_count: 0) ++ result = AccountView.render("show.json", %{user: user}) ++ ++ assert result.following_count == 0 ++ assert result.followers_count == 0 ++ end ++ describe "hiding follows/following" do test "shows when follows/followers stats are hidden and sets follow/follower count to 0" do user =