Add deactivated status for privileged users

Deactivated users are only visible to users privileged with :user_activation since fc317f3b17
Here we also make sure the users who are deactivated get the status deactivated for users who are allowed to see these users
This commit is contained in:
Ilja 2022-06-21 09:21:45 +02:00
commit 143ea7b80a
2 changed files with 9 additions and 7 deletions

View file

@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
use Pleroma.DataCase
use Pleroma.DataCase, async: false
alias Pleroma.User
alias Pleroma.UserRelationship
@ -214,8 +214,10 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
assert represented.url == "https://channels.tests.funkwhale.audio/channels/compositions"
end
test "Represent a deactivated user for an admin" do
admin = insert(:user, is_admin: true)
test "Represent a deactivated user for a privileged user" do
clear_config([:instance, :moderator_privileges], [:user_activation])
admin = insert(:user, is_moderator: true)
deactivated_user = insert(:user, is_active: false)
represented = AccountView.render("show.json", %{user: deactivated_user, for: admin})
assert represented[:pleroma][:deactivated] == true