|> Transmogrifier.add_emoji_tags()
|> Map.get("tag", [])
+ fields =
+ user.info
+ |> User.Info.fields()
+ |> Enum.map(&Map.put(&1, "type", "PropertyValue"))
+
%{
"id" => user.ap_id,
"type" => "Person",
"publicKeyPem" => public_key
},
"endpoints" => endpoints,
+ "attachment" => fields,
"tag" => (user.info.source_data["tag"] || []) ++ user_tags
}
|> Map.merge(maybe_make_image(&User.avatar_url/2, "icon", user))
assert String.contains?(result["publicKey"]["publicKeyPem"], "BEGIN PUBLIC KEY")
end
+ test "Renders profile fields" do
+ fields = [
+ %{"name" => "foo", "value" => "bar"},
+ %{"name" => "website", "value" => "cofe.my"}
+ ]
+
+ user = insert(:user, info: %{fields: fields})
+
+ assert %{
+ "attachment" => [
+ %{"name" => "foo", "type" => "PropertyValue", "value" => "bar"},
+ %{"name" => "website", "type" => "PropertyValue", "value" => "cofe.my"}
+ ]
+ } = UserView.render("user.json", %{user: user})
+ end
+
test "Does not add an avatar image if the user hasn't set one" do
user = insert(:user)
{:ok, user} = User.ensure_keys_present(user)