diff options
author | Ilja <ilja@ilja.space> | 2022-06-21 09:21:45 +0200 |
---|---|---|
committer | Ilja <ilja@ilja.space> | 2022-06-21 12:10:27 +0200 |
commit | 143ea7b80a228d9bd23a77354fe214553ca2b8cc (patch) | |
tree | 4b215b845e856bf31ebf3ac7303358c828b87bd7 /lib | |
parent | e21ef5aef389f7cef9ba53525d2d38bb29f5e257 (diff) | |
download | pleroma-143ea7b80a228d9bd23a77354fe214553ca2b8cc.tar.gz pleroma-143ea7b80a228d9bd23a77354fe214553ca2b8cc.zip |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/views/account_view.ex | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 988eedbb1..d3f2245e2 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -398,12 +398,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do defp maybe_put_allow_following_move(data, _, _), do: data - defp maybe_put_activation_status(data, user, %User{is_admin: true}) do - Kernel.put_in(data, [:pleroma, :deactivated], !user.is_active) + defp maybe_put_activation_status(data, user, user_for) do + if User.privileged?(user_for, :user_activation), + do: Kernel.put_in(data, [:pleroma, :deactivated], !user.is_active), + else: data end - defp maybe_put_activation_status(data, _, _), do: data - defp maybe_put_unread_conversation_count(data, %User{id: user_id} = user, %User{id: user_id}) do data |> Kernel.put_in( |