Commit 3c849d04 authored by kaniini's avatar kaniini

Merge branch 'deactivated-in-user-view' into 'develop'

Add activation status to the regular user view

See merge request pleroma/pleroma!874
parents 9cc98b49 6b110110
......@@ -132,6 +132,7 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
"confirmation_pending" => user_info.confirmation_pending,
"tags" => user.tags
|> maybe_with_activation_status(user, for_user)
|> maybe_with_follow_request_count(user, for_user)
......@@ -148,6 +149,12 @@ defmodule Pleroma.Web.TwitterAPI.UserView do
defp maybe_with_activation_status(data, user, %User{info: %{is_admin: true}}) do
Map.put(data, "deactivated",
defp maybe_with_activation_status(data, _, _), do: data
defp maybe_with_follow_request_count(data, %User{id: id, info: %{locked: true}} = user, %User{
id: id
}) do
......@@ -239,6 +239,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
assert represented["role"] == nil
test "A regular user for the admin", %{user: user} do
admin = insert(:user, %{info: %{is_admin: true}})
represented = UserView.render("show.json", %{user: user, for: admin})
assert represented["pleroma"]["deactivated"] == false
test "A blocked user for the blocker" do
user = insert(:user)
blocker = insert(:user)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment