projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into feature/admin-api-user-statuses
[akkoma]
/
lib
/
pleroma
/
web
/
mastodon_api
/
views
/
account_view.ex
diff --git
a/lib/pleroma/web/mastodon_api/views/account_view.ex
b/lib/pleroma/web/mastodon_api/views/account_view.ex
index 04d48534090fa1f295e08167945d60b3c4627c34..62c516f8eb97989538a1b3e3c3b0e050574ce50d 100644
(file)
--- a/
lib/pleroma/web/mastodon_api/views/account_view.ex
+++ b/
lib/pleroma/web/mastodon_api/views/account_view.ex
@@
-66,6
+66,8
@@
defmodule Pleroma.Web.MastodonAPI.AccountView do
end
defp do_render("account.json", %{user: user} = opts) do
end
defp do_render("account.json", %{user: user} = opts) do
+ display_name = HTML.strip_tags(user.name || user.nickname)
+
image = User.avatar_url(user) |> MediaProxy.url()
header = User.banner_url(user) |> MediaProxy.url()
user_info = User.get_cached_user_info(user)
image = User.avatar_url(user) |> MediaProxy.url()
header = User.banner_url(user) |> MediaProxy.url()
user_info = User.get_cached_user_info(user)
@@
-96,7
+98,7
@@
defmodule Pleroma.Web.MastodonAPI.AccountView do
id: to_string(user.id),
username: username_from_nickname(user.nickname),
acct: user.nickname,
id: to_string(user.id),
username: username_from_nickname(user.nickname),
acct: user.nickname,
- display_name:
user.name || user.nick
name,
+ display_name:
display_
name,
locked: user_info.locked,
created_at: Utils.to_masto_date(user.inserted_at),
followers_count: user_info.follower_count,
locked: user_info.locked,
created_at: Utils.to_masto_date(user.inserted_at),
followers_count: user_info.follower_count,
@@
-124,13
+126,16
@@
defmodule Pleroma.Web.MastodonAPI.AccountView do
hide_followers: user.info.hide_followers,
hide_follows: user.info.hide_follows,
hide_favorites: user.info.hide_favorites,
hide_followers: user.info.hide_followers,
hide_follows: user.info.hide_follows,
hide_favorites: user.info.hide_favorites,
- relationship: relationship
+ relationship: relationship,
+ skip_thread_containment: user.info.skip_thread_containment,
+ background_image: image_url(user.info.background) |> MediaProxy.url()
}
}
|> maybe_put_role(user, opts[:for])
|> maybe_put_settings(user, opts[:for], user_info)
|> maybe_put_notification_settings(user, opts[:for])
|> maybe_put_settings_store(user, opts[:for], opts)
}
}
|> maybe_put_role(user, opts[:for])
|> maybe_put_settings(user, opts[:for], user_info)
|> maybe_put_notification_settings(user, opts[:for])
|> maybe_put_settings_store(user, opts[:for], opts)
+ |> maybe_put_chat_token(user, opts[:for], opts)
end
defp username_from_nickname(string) when is_binary(string) do
end
defp username_from_nickname(string) when is_binary(string) do
@@
-157,11
+162,20
@@
defmodule Pleroma.Web.MastodonAPI.AccountView do
with_pleroma_settings: true
}) do
data
with_pleroma_settings: true
}) do
data
- |> Kernel.put_in([:pleroma, :settings], info.pleroma_settings_store)
+ |> Kernel.put_in([:pleroma, :settings
_store
], info.pleroma_settings_store)
end
defp maybe_put_settings_store(data, _, _, _), do: data
end
defp maybe_put_settings_store(data, _, _, _), do: data
+ defp maybe_put_chat_token(data, %User{id: id}, %User{id: id}, %{
+ with_chat_token: token
+ }) do
+ data
+ |> Kernel.put_in([:pleroma, :chat_token], token)
+ end
+
+ defp maybe_put_chat_token(data, _, _, _), do: data
+
defp maybe_put_role(data, %User{info: %{show_role: true}} = user, _) do
data
|> Kernel.put_in([:pleroma, :is_admin], user.info.is_admin)
defp maybe_put_role(data, %User{info: %{show_role: true}} = user, _) do
data
|> Kernel.put_in([:pleroma, :is_admin], user.info.is_admin)
@@
-181,4
+195,7
@@
defmodule Pleroma.Web.MastodonAPI.AccountView do
end
defp maybe_put_notification_settings(data, _, _), do: data
end
defp maybe_put_notification_settings(data, _, _), do: data
+
+ defp image_url(%{"url" => [%{"href" => href} | _]}), do: href
+ defp image_url(_), do: nil
end
end