assert [^pending_follower] = User.get_follow_requests(locked)
end
+ test "doesn't return follow requests for deactivated accounts" do
+ locked = insert(:user, locked: true)
+ pending_follower = insert(:user, %{deactivated: true})
+
+ CommonAPI.follow(pending_follower, locked)
+
+ assert true == pending_follower.deactivated
+ assert [] = User.get_follow_requests(locked)
+ end
+
test "clears follow requests when requester is blocked" do
followed = insert(:user, locked: true)
follower = insert(:user)
end
end
- describe "visible_for?/2" do
+ describe "visible_for/2" do
test "returns true when the account is itself" do
user = insert(:user, local: true)
- assert User.visible_for?(user, user)
+ assert User.visible_for(user, user) == :visible
end
test "returns false when the account is unauthenticated and auth is required" do
user = insert(:user, local: true, confirmation_pending: true)
other_user = insert(:user, local: true)
- refute User.visible_for?(user, other_user)
+ refute User.visible_for(user, other_user) == :visible
end
test "returns true when the account is unauthenticated and auth is not required" do
user = insert(:user, local: true, confirmation_pending: true)
other_user = insert(:user, local: true)
- assert User.visible_for?(user, other_user)
+ assert User.visible_for(user, other_user) == :visible
end
test "returns true when the account is unauthenticated and being viewed by a privileged account (auth required)" do
user = insert(:user, local: true, confirmation_pending: true)
other_user = insert(:user, local: true, is_admin: true)
- assert User.visible_for?(user, other_user)
+ assert User.visible_for(user, other_user) == :visible
end
end