Add options for rendering avatars when fetching users via the API.

Review Request #10444 — Created March 12, 2019 and submitted

Information

Review Board
release-3.0.x

Reviewers

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
clients.

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
values.

Summary ID
Add options for rendering avatars when fetching users via the API.
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 clients. 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.
c8fe318dac11e9b36be23cf3648108426d5672b0
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (9937b9c)