diff options
| author | Maxim Filippov <colixer@gmail.com> | 2019-08-14 22:45:32 +0000 |
|---|---|---|
| committer | Maxim Filippov <colixer@gmail.com> | 2019-08-14 22:45:32 +0000 |
| commit | ec969eec5149c5fe2a3e676ea07384b4597487f1 (patch) | |
| tree | b725022b93c7f354116e50d54009e0dc5dc19eaf /test/web/mastodon_api/account_view_test.exs | |
| parent | b27fafe161241c954b713281bebd6ffe1e990884 (diff) | |
| parent | 27b747546a7796de57e88f454b2c2810c7523f97 (diff) | |
| download | pleroma-ec969eec5149c5fe2a3e676ea07384b4597487f1.tar.gz pleroma-ec969eec5149c5fe2a3e676ea07384b4597487f1.zip | |
Merge branch 'develop' into 'fix/admin-api-user-deletion'
# Conflicts:
# CHANGELOG.md
Diffstat (limited to 'test/web/mastodon_api/account_view_test.exs')
| -rw-r--r-- | test/web/mastodon_api/account_view_test.exs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs index 905e9af98..a26f514a5 100644 --- a/test/web/mastodon_api/account_view_test.exs +++ b/test/web/mastodon_api/account_view_test.exs @@ -356,4 +356,31 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do result = AccountView.render("account.json", %{user: user}) refute result.display_name == "<marquee> username </marquee>" end + + describe "hiding follows/following" do + test "shows when follows/following are hidden and sets follower/following count to 0" do + user = insert(:user, info: %{hide_followers: true, hide_follows: true}) + other_user = insert(:user) + {:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user) + {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user) + + assert %{ + followers_count: 0, + following_count: 0, + pleroma: %{hide_follows: true, hide_followers: true} + } = AccountView.render("account.json", %{user: user}) + end + + test "shows actual follower/following count to the account owner" do + user = insert(:user, info: %{hide_followers: true, hide_follows: true}) + other_user = insert(:user) + {:ok, user, other_user, _activity} = CommonAPI.follow(user, other_user) + {:ok, _other_user, user, _activity} = CommonAPI.follow(other_user, user) + + assert %{ + followers_count: 1, + following_count: 1 + } = AccountView.render("account.json", %{user: user, for: user}) + end + end end |
