diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index b93ce9c2c..7dfc6ce7b 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -326,7 +326,7 @@ defmodule Pleroma.User do end def visible_for(%User{} = user, for_user) do - if superuser?(for_user) do + if privileged?(for_user, :user_activation) do :visible else visible_account_status(user) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 192bffaa9..22d55cd53 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1986,13 +1986,18 @@ defmodule Pleroma.UserTest do assert User.visible_for(user, other_user) == :visible end - test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do + test "returns true when the account is unconfirmed and being viewed by a privileged account (privilege :user_activation, confirmation required)" do clear_config([:instance, :account_activation_required], true) + clear_config([:instance, :admin_privileges], [:user_activation]) user = insert(:user, local: true, is_confirmed: false) other_user = insert(:user, local: true, is_admin: true) assert User.visible_for(user, other_user) == :visible + + clear_config([:instance, :admin_privileges], []) + + refute User.visible_for(user, other_user) == :visible end end