forked from AkkomaGang/akkoma
Render AKAs in Actor endpoints
This commit is contained in:
parent
cbce880076
commit
11d40e92b7
2 changed files with 8 additions and 1 deletions
|
@ -112,7 +112,8 @@ def render("user.json", %{user: user}) do
|
||||||
"tag" => emoji_tags,
|
"tag" => emoji_tags,
|
||||||
# Note: key name is indeed "discoverable" (not an error)
|
# Note: key name is indeed "discoverable" (not an error)
|
||||||
"discoverable" => user.is_discoverable,
|
"discoverable" => user.is_discoverable,
|
||||||
"capabilities" => capabilities
|
"capabilities" => capabilities,
|
||||||
|
"alsoKnownAs" => user.also_known_as
|
||||||
}
|
}
|
||||||
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
|
||||||
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
|> Map.merge(maybe_make_image(&User.banner_url/2, "image", user))
|
||||||
|
|
|
@ -80,6 +80,12 @@ test "renders an invisible user with the invisible property set to true" do
|
||||||
assert %{"invisible" => true} = UserView.render("service.json", %{user: user})
|
assert %{"invisible" => true} = UserView.render("service.json", %{user: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "renders AKAs" do
|
||||||
|
akas = ["https://i.tusooa.xyz/users/test-pleroma"]
|
||||||
|
user = insert(:user, also_known_as: akas)
|
||||||
|
assert %{"alsoKnownAs" => ^akas} = UserView.render("user.json", %{user: user})
|
||||||
|
end
|
||||||
|
|
||||||
describe "endpoints" do
|
describe "endpoints" do
|
||||||
test "local users have a usable endpoints structure" do
|
test "local users have a usable endpoints structure" do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
Loading…
Reference in a new issue