Merge branch 'fetch-actor-preferredusername' into 'main'

Fix preferredUsername of internal.fetch actor

See merge request soapbox-pub/rebased!300
This commit is contained in:
Alex Gleason 2024-01-19 00:05:51 +00:00
commit 6ea0d8e7e7

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)