From 24e08152518a55ac9363544268c34e745345095d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 18 Jan 2024 17:55:54 -0600 Subject: [PATCH] Fix preferredUsername of internal.fetch actor --- lib/pleroma/web/activity_pub/views/user_view.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index ca3bc291d2..0f884fa460 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -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)