X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Faccount_view.ex;h=ec720e472e20bd368c80cf79fa82922239bf5a50;hb=d0bd4348b34075e1d9ed6905255c85c452e0b4ca;hp=7f50f3aa692efc38a666c8f19f874aa8e4ff67b2;hpb=ef1718a045065ec800dbd2b60879a28eb82caad8;p=akkoma diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 7f50f3aa6..ec720e472 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -74,14 +74,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do following_count = if !user.hide_follows_count or !user.hide_follows or opts[:for] == user do - user.following_count + user.following_count || 0 else 0 end followers_count = if !user.hide_followers_count or !user.hide_followers or opts[:for] == user do - user.follower_count + user.follower_count || 0 else 0 end @@ -162,6 +162,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do |> maybe_put_chat_token(user, opts[:for], opts) |> maybe_put_activation_status(user, opts[:for]) |> maybe_put_follow_requests_count(user, opts[:for]) + |> maybe_put_allow_following_move(user, opts[:for]) |> maybe_put_unread_conversation_count(user, opts[:for]) end @@ -238,6 +239,12 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do defp maybe_put_notification_settings(data, _, _), do: data + defp maybe_put_allow_following_move(data, %User{id: user_id} = user, %User{id: user_id}) do + Kernel.put_in(data, [:pleroma, :allow_following_move], user.allow_following_move) + end + + 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.deactivated) end