mastodon api: embed relationship card under account card for Pleroma FE convenience
This commit is contained in:
parent
14bc6bd40f
commit
1536640962
2 changed files with 73 additions and 4 deletions
|
|
@ -32,7 +32,11 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
}
|
||||
end
|
||||
|
||||
def render("relationship.json", %{user: user, target: target}) do
|
||||
def render("relationship.json", %{user: nil, target: _target}) do
|
||||
%{}
|
||||
end
|
||||
|
||||
def render("relationship.json", %{user: %User{} = user, target: %User{} = target}) do
|
||||
follow_activity = Pleroma.Web.ActivityPub.Utils.fetch_latest_follow(user, target)
|
||||
|
||||
requested =
|
||||
|
|
@ -85,6 +89,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
|
||||
bio = HTML.filter_tags(user.bio, User.html_filter_policy(opts[:for]))
|
||||
|
||||
relationship = render("relationship.json", %{user: opts[:for], target: user})
|
||||
|
||||
%{
|
||||
id: to_string(user.id),
|
||||
username: username_from_nickname(user.nickname),
|
||||
|
|
@ -115,7 +121,8 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
|
|||
confirmation_pending: user_info.confirmation_pending,
|
||||
tags: user.tags,
|
||||
is_moderator: user.info.is_moderator,
|
||||
is_admin: user.info.is_admin
|
||||
is_admin: user.info.is_admin,
|
||||
relationship: relationship
|
||||
}
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue