Render AKAs in Actor endpoints
authorAlex Gleason <alex@alexgleason.me>
Thu, 31 Dec 2020 00:53:27 +0000 (18:53 -0600)
committerAlex Gleason <alex@alexgleason.me>
Thu, 31 Dec 2020 00:53:27 +0000 (18:53 -0600)
lib/pleroma/web/activity_pub/views/user_view.ex
test/pleroma/web/activity_pub/views/user_view_test.exs

index 93c9f436c4acb70478dfe9919281c6e3c8662c13..241224b57f1ad65a78097f68c714f94de0577429 100644 (file)
@@ -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))
index fe6ddf0d683c1c50867178ecb8ad881bb2885b3d..5702c1b6f07877c02d822ea86a6ecb88cd948585 100644 (file)
@@ -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)