Serialize avatar URL in user resource only when URLs available
Review Request #9457 — Created Dec. 19, 2017 and submitted — Latest diff uploaded
Previously we assumed that all avatar services would return URLs.
However, it is possible that the service has yet to be configured for a
user (e.g., they haven't uploaded an avatar yet for the
FileUploadAvatarService
) or the avatar service returns bad data. In
these cases, we now wrap the serialization in atry..except
to ensure
that we don't cause exceptions that crash the resource.Additionally, we also ensure that we serialize the
avatar_urls
field
as{}
instead ofNone
when there are no URLs to simplify
deserialization logic.
Ran unit tests.