Merge branch 'bugfix/follower_count' into 'develop'
update the follower count when a follower is blocked See merge request pleroma/pleroma!1033
This commit is contained in:
commit
0a02ed7a2f
|
@ -945,6 +945,8 @@ def block(blocker, %User{ap_id: ap_id} = blocked) do
|
||||||
unfollow(blocked, blocker)
|
unfollow(blocked, blocker)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
{:ok, blocker} = update_follower_count(blocker)
|
||||||
|
|
||||||
info_cng =
|
info_cng =
|
||||||
blocker.info
|
blocker.info
|
||||||
|> User.Info.add_to_block(ap_id)
|
|> User.Info.add_to_block(ap_id)
|
||||||
|
|
|
@ -1125,4 +1125,21 @@ test "bookmarks" do
|
||||||
assert {:ok, user_state3} = User.bookmark(user, id2)
|
assert {:ok, user_state3} = User.bookmark(user, id2)
|
||||||
assert user_state3.bookmarks == [id2]
|
assert user_state3.bookmarks == [id2]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "follower count is updated when a follower is blocked" do
|
||||||
|
user = insert(:user)
|
||||||
|
follower = insert(:user)
|
||||||
|
follower2 = insert(:user)
|
||||||
|
follower3 = insert(:user)
|
||||||
|
|
||||||
|
{:ok, follower} = Pleroma.User.follow(follower, user)
|
||||||
|
{:ok, _follower2} = Pleroma.User.follow(follower2, user)
|
||||||
|
{:ok, _follower3} = Pleroma.User.follow(follower3, user)
|
||||||
|
|
||||||
|
{:ok, _} = Pleroma.User.block(user, follower)
|
||||||
|
|
||||||
|
user_show = Pleroma.Web.TwitterAPI.UserView.render("show.json", %{user: user})
|
||||||
|
|
||||||
|
assert Map.get(user_show, "followers_count") == 2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue