From: Alex Gleason Date: Thu, 31 Dec 2020 00:53:27 +0000 (-0600) Subject: Render AKAs in Actor endpoints X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=11d40e92b7ee4d855c02d24a485035fb622a138a;p=akkoma Render AKAs in Actor endpoints --- diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index 93c9f436c..241224b57 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -112,7 +112,8 @@ defmodule Pleroma.Web.ActivityPub.UserView do "tag" => emoji_tags, # Note: key name is indeed "discoverable" (not an error) "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.banner_url/2, "image", user)) diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs index fe6ddf0d6..5702c1b6f 100644 --- a/test/pleroma/web/activity_pub/views/user_view_test.exs +++ b/test/pleroma/web/activity_pub/views/user_view_test.exs @@ -80,6 +80,12 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do assert %{"invisible" => true} = UserView.render("service.json", %{user: user}) 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 test "local users have a usable endpoints structure" do user = insert(:user)