forked from AkkomaGang/akkoma
Fix follower count test.
This commit is contained in:
parent
8e3d8bde04
commit
6f90ceb2ed
2 changed files with 5 additions and 5 deletions
|
@ -222,7 +222,7 @@ def follow(%User{} = follower, %User{info: info} = followed) do
|
||||||
ap_followers = followed.follower_address
|
ap_followers = followed.follower_address
|
||||||
|
|
||||||
cond do
|
cond do
|
||||||
following?(follower, followed) or info["deactivated"] ->
|
following?(follower, followed) or info.deactivated ->
|
||||||
{:error, "Could not follow user: #{followed.nickname} is already on your list."}
|
{:error, "Could not follow user: #{followed.nickname} is already on your list."}
|
||||||
|
|
||||||
deny_follow_blocked and blocks?(followed, follower) ->
|
deny_follow_blocked and blocks?(followed, follower) ->
|
||||||
|
|
|
@ -34,7 +34,7 @@ test "follow takes a user and another user" do
|
||||||
user = Repo.get(User, user.id)
|
user = Repo.get(User, user.id)
|
||||||
|
|
||||||
followed = User.get_by_ap_id(followed.ap_id)
|
followed = User.get_by_ap_id(followed.ap_id)
|
||||||
assert followed.info["follower_count"] == 1
|
assert followed.info.follower_count == 1
|
||||||
|
|
||||||
assert User.ap_followers(followed) in user.following
|
assert User.ap_followers(followed) in user.following
|
||||||
end
|
end
|
||||||
|
@ -358,11 +358,11 @@ test "it sets the info->follower_count property" do
|
||||||
|
|
||||||
User.follow(follower, user)
|
User.follow(follower, user)
|
||||||
|
|
||||||
assert user.info["follower_count"] == nil
|
assert user.info.follower_count == 0
|
||||||
|
|
||||||
{:ok, user} = User.update_follower_count(user)
|
{:ok, user} = User.update_follower_count(user)
|
||||||
|
|
||||||
assert user.info["follower_count"] == 1
|
assert user.info.follower_count == 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ test ".delete deactivates a user, all follow relationships and all create activi
|
||||||
follower = Repo.get(User, follower.id)
|
follower = Repo.get(User, follower.id)
|
||||||
user = Repo.get(User, user.id)
|
user = Repo.get(User, user.id)
|
||||||
|
|
||||||
assert user.info["deactivated"]
|
assert user.info.deactivated
|
||||||
|
|
||||||
refute User.following?(user, followed)
|
refute User.following?(user, followed)
|
||||||
refute User.following?(followed, follower)
|
refute User.following?(followed, follower)
|
||||||
|
|
Loading…
Reference in a new issue