Only serialize new fields if they are present
@@ -248,7 +248,9 @@ public class UserApiHandler extends LoggingRequestHandler {
if (user.nickname() != null) userObject.setString("nickname", user.nickname());
if (user.picture() != null) userObject.setString("picture", user.picture());
userObject.setBool("verified", user.isVerified());
+ if (!user.lastLogin().equals(User.NO_DATE))
userObject.setString("lastLogin", user.lastLogin().format(DateTimeFormatter.ISO_DATE));
+ if (user.loginCount() > -1)
userObject.setLong("loginCount", user.loginCount());
}
