Add options for rendering avatars when fetching users via the API.
Review Request #10444 — Created March 12, 2019 and submitted
The user API provides the URLs for any avatar images available, but this
isn't very helpful for avatar backends that don't make use of images
(such as the new fallback backend in Djblets). For those, avatar URLs
will be empty, and the client won't have anything to render.
With this change, clients of the API now have the ability to request
that avatars be rendered to HTML for a given size or sizes. This is
optional, and off by default, in order to avoid sending unwanted data to
clients that don't need it, and because we don't pick any default size
for the avatars that are being rendered. It's entirely up to the
The implementation supports requests during any GET request (using
?render-avatars-at=<size>,[...]or when creating a new user through
a POST request (using
render_avatars_at=<size>,[...]). It handles
invalid values in the list gracefully.
Unit tests passed.
Manually tested with users with different backends, and with invalid