Fix preferredUsername of internal.fetch actor

This commit is contained in:
Alex Gleason 2024-01-18 17:55:54 -06:00
parent 48ce0783ec
commit 24e0815251
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -67,8 +67,10 @@ def render("service.json", %{user: user}) do
def render("user.json", %{user: %User{nickname: nil} = user}),
do: render("service.json", %{user: user})
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}),
do: render("service.json", %{user: user}) |> Map.put("preferredUsername", user.nickname)
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}) do
nickname = user.nickname |> String.split("@") |> List.first()
render("service.json", %{user: user}) |> Map.put("preferredUsername", nickname)
end
def render("user.json", %{user: user}) do
{:ok, _, public_key} = Keys.keys_from_pem(user.keys)