Refactor
This commit is contained in:
parent
16cfb89240
commit
1fce56c7df
|
@ -57,7 +57,6 @@ 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
|
||||||
|
|
||||||
|
@ -66,7 +65,7 @@ def render("user.json", %{user: %User{nickname: nil} = user}),
|
||||||
do: render("service.json", %{user: user})
|
do: render("service.json", %{user: user})
|
||||||
|
|
||||||
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}),
|
def render("user.json", %{user: %User{nickname: "internal." <> _} = user}),
|
||||||
do: render("service.json", %{user: user})
|
do: render("service.json", %{user: user}) |> Map.put("preferredUsername", user.nickname)
|
||||||
|
|
||||||
def render("user.json", %{user: user}) do
|
def render("user.json", %{user: user}) do
|
||||||
{:ok, user} = User.ensure_keys_present(user)
|
{:ok, user} = User.ensure_keys_present(user)
|
||||||
|
|
Loading…
Reference in New Issue