Only add preferredUsername to service actor json when the underlying user actually has a username

This commit is contained in:
Thibaut Girka 2019-08-03 18:28:08 +00:00
parent a187dbb326
commit 16cfb89240

View File

@ -45,7 +45,6 @@ def render("service.json", %{user: user}) do
"following" => "#{user.ap_id}/following", "following" => "#{user.ap_id}/following",
"followers" => "#{user.ap_id}/followers", "followers" => "#{user.ap_id}/followers",
"inbox" => "#{user.ap_id}/inbox", "inbox" => "#{user.ap_id}/inbox",
"preferredUsername" => user.nickname,
"name" => "Pleroma", "name" => "Pleroma",
"summary" => "summary" =>
"An internal service actor for this Pleroma instance. No user-serviceable parts inside.", "An internal service actor for this Pleroma instance. No user-serviceable parts inside.",
@ -58,6 +57,7 @@ def render("service.json", %{user: user}) do
}, },
"endpoints" => endpoints "endpoints" => endpoints
} }
|> Map.merge(if user.nickname == nil do %{} else %{ "preferredUsername" => user.nickname})
|> Map.merge(Utils.make_json_ld_header()) |> Map.merge(Utils.make_json_ld_header())
end end