summaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api/views/account_view.ex
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2021-03-02 19:54:30 +0000
committerlain <lain@soykaf.club>2021-03-02 19:54:30 +0000
commitb221d77a6da07c684bdbc63ddf4500e0d7ffeae8 (patch)
tree0015c7c3ea57f7340fbf80fd230a5f5e1c548148 /lib/pleroma/web/mastodon_api/views/account_view.ex
parentc2186a62d54043ea9638d33f80c7576aba9783e8 (diff)
parent0a589c887bd4215e7d443a34c194fd0a3bde8f72 (diff)
Merge branch 'release/2.3.0' into 'stable'
Release/2.3.0 See merge request pleroma/pleroma!3354
Diffstat (limited to 'lib/pleroma/web/mastodon_api/views/account_view.ex')
-rw-r--r--lib/pleroma/web/mastodon_api/views/account_view.ex31
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex
index d54cae732..ac25aefdd 100644
--- a/lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/account_view.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AccountView do
@@ -187,18 +187,14 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
header_static = User.banner_url(user) |> MediaProxy.preview_url(static: true)
following_count =
- if !user.hide_follows_count or !user.hide_follows or opts[:for] == user do
- user.following_count || 0
- else
- 0
- end
+ if !user.hide_follows_count or !user.hide_follows or opts[:for] == user,
+ do: user.following_count,
+ else: 0
followers_count =
- if !user.hide_followers_count or !user.hide_followers or opts[:for] == user do
- user.follower_count || 0
- else
- 0
- end
+ if !user.hide_followers_count or !user.hide_followers or opts[:for] == user,
+ do: user.follower_count,
+ else: 0
bot = user.actor_type == "Service"
@@ -261,15 +257,18 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
sensitive: false,
fields: user.raw_fields,
pleroma: %{
- discoverable: user.discoverable,
+ discoverable: user.is_discoverable,
actor_type: user.actor_type
}
},
- # Pleroma extension
+ # Pleroma extensions
+ # Note: it's insecure to output :email but fully-qualified nickname may serve as safe stub
+ fqn: User.full_nickname(user),
pleroma: %{
ap_id: user.ap_id,
- confirmation_pending: user.confirmation_pending,
+ also_known_as: user.also_known_as,
+ is_confirmed: user.is_confirmed,
tags: user.tags,
hide_followers_count: user.hide_followers_count,
hide_follows_count: user.hide_follows_count,
@@ -379,7 +378,7 @@ 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.deactivated)
+ Kernel.put_in(data, [:pleroma, :deactivated], !user.is_active)
end
defp maybe_put_activation_status(data, _, _), do: data
@@ -388,7 +387,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
data
|> Kernel.put_in(
[:pleroma, :unread_conversation_count],
- user.unread_conversation_count
+ Pleroma.Conversation.Participation.unread_count(user)
)
end