Merge branch '2144-empty-users' into 'develop'
User: Remote users don't need to be confirmed or approved Closes #2144 See merge request pleroma/pleroma!3003
This commit is contained in:
commit
3a9baa9d0d
|
@ -275,9 +275,9 @@ def binary_id(%User{} = user), do: binary_id(user.id)
|
||||||
@spec account_status(User.t()) :: account_status()
|
@spec account_status(User.t()) :: account_status()
|
||||||
def account_status(%User{deactivated: true}), do: :deactivated
|
def account_status(%User{deactivated: true}), do: :deactivated
|
||||||
def account_status(%User{password_reset_pending: true}), do: :password_reset_pending
|
def account_status(%User{password_reset_pending: true}), do: :password_reset_pending
|
||||||
def account_status(%User{approval_pending: true}), do: :approval_pending
|
def account_status(%User{local: true, approval_pending: true}), do: :approval_pending
|
||||||
|
|
||||||
def account_status(%User{confirmation_pending: true}) do
|
def account_status(%User{local: true, confirmation_pending: true}) do
|
||||||
if Config.get([:instance, :account_activation_required]) do
|
if Config.get([:instance, :account_activation_required]) do
|
||||||
:confirmation_pending
|
:confirmation_pending
|
||||||
else
|
else
|
||||||
|
|
|
@ -1676,7 +1676,7 @@ test "returns true when the account is itself" do
|
||||||
assert User.visible_for(user, user) == :visible
|
assert User.visible_for(user, user) == :visible
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns false when the account is unauthenticated and auth is required" do
|
test "returns false when the account is unconfirmed and confirmation is required" do
|
||||||
Pleroma.Config.put([:instance, :account_activation_required], true)
|
Pleroma.Config.put([:instance, :account_activation_required], true)
|
||||||
|
|
||||||
user = insert(:user, local: true, confirmation_pending: true)
|
user = insert(:user, local: true, confirmation_pending: true)
|
||||||
|
@ -1685,14 +1685,23 @@ test "returns false when the account is unauthenticated and auth is required" do
|
||||||
refute User.visible_for(user, other_user) == :visible
|
refute User.visible_for(user, other_user) == :visible
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns true when the account is unauthenticated and auth is not required" do
|
test "returns true when the account is unconfirmed and confirmation is required but the account is remote" do
|
||||||
|
Pleroma.Config.put([:instance, :account_activation_required], true)
|
||||||
|
|
||||||
|
user = insert(:user, local: false, confirmation_pending: true)
|
||||||
|
other_user = insert(:user, local: true)
|
||||||
|
|
||||||
|
assert User.visible_for(user, other_user) == :visible
|
||||||
|
end
|
||||||
|
|
||||||
|
test "returns true when the account is unconfirmed and confirmation is not required" do
|
||||||
user = insert(:user, local: true, confirmation_pending: true)
|
user = insert(:user, local: true, confirmation_pending: true)
|
||||||
other_user = insert(:user, local: true)
|
other_user = insert(:user, local: true)
|
||||||
|
|
||||||
assert User.visible_for(user, other_user) == :visible
|
assert User.visible_for(user, other_user) == :visible
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns true when the account is unauthenticated and being viewed by a privileged account (auth required)" do
|
test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do
|
||||||
Pleroma.Config.put([:instance, :account_activation_required], true)
|
Pleroma.Config.put([:instance, :account_activation_required], true)
|
||||||
|
|
||||||
user = insert(:user, local: true, confirmation_pending: true)
|
user = insert(:user, local: true, confirmation_pending: true)
|
||||||
|
|
Loading…
Reference in a new issue