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",
"followers" => "#{user.ap_id}/followers",
"inbox" => "#{user.ap_id}/inbox",
"preferredUsername" => user.nickname,
"name" => "Pleroma",
"summary" =>
"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
}
|> Map.merge(if user.nickname == nil do %{} else %{ "preferredUsername" => user.nickname})
|> Map.merge(Utils.make_json_ld_header())
end