account visibility

This commit is contained in:
Alexander Strizhakov 2020-05-07 13:44:38 +03:00
commit e7bc2f980c
No known key found for this signature in database
GPG key ID: 022896A53AEF1381
6 changed files with 105 additions and 47 deletions

View file

@ -1289,11 +1289,11 @@ defmodule Pleroma.UserTest do
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)
end
test "returns false when the account is unauthenticated and auth is required" do
@ -1302,14 +1302,14 @@ defmodule Pleroma.UserTest 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) == true
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)
end
test "returns true when the account is unauthenticated and being viewed by a privileged account (auth required)" do
@ -1318,7 +1318,7 @@ defmodule Pleroma.UserTest 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)
end
end