From a1c8aa4721de8f5edd7d69dcd745586df23f5a31 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sat, 18 Jun 2022 10:55:45 +0200 Subject: [PATCH] Remove function superuser? Everything now happens with privileged?/2 --- lib/pleroma/user.ex | 5 ----- test/pleroma/user_test.exs | 28 ---------------------------- 2 files changed, 33 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index b68d5cf9a..af29f85b5 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -371,11 +371,6 @@ defp privileged_for?(privilege_tag, true, config_role_key), defp privileged_for?(_, _, _), do: false - @spec superuser?(User.t()) :: boolean() - def superuser?(%User{local: true, is_admin: true}), do: true - def superuser?(%User{local: true, is_moderator: true}), do: true - def superuser?(_), do: false - @spec invisible?(User.t()) :: boolean() def invisible?(%User{invisible: true}), do: true def invisible?(_), do: false diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index d110d71da..9f8be7fa2 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1918,34 +1918,6 @@ test "returns true for local admins if, and only if, they are privileged" do end end - describe "superuser?/1" do - test "returns false for unprivileged users" do - user = insert(:user, local: true) - - refute User.superuser?(user) - end - - test "returns false for remote users" do - user = insert(:user, local: false) - remote_admin_user = insert(:user, local: false, is_admin: true) - - refute User.superuser?(user) - refute User.superuser?(remote_admin_user) - end - - test "returns true for local moderators" do - user = insert(:user, local: true, is_moderator: true) - - assert User.superuser?(user) - end - - test "returns true for local admins" do - user = insert(:user, local: true, is_admin: true) - - assert User.superuser?(user) - end - end - describe "invisible?/1" do test "returns true for an invisible user" do user = insert(:user, local: true, invisible: true)