Add a fallback avatar service for when other services aren't available.

Review Request #10443 — Created March 12, 2019 and submitted — Latest diff uploaded

Information

Djblets
release-1.0.x

Reviewers

With the existing avatar implementation, users that don't have a usable
avatar service (such as when Gravatars are used but the user has opted
out) would result in an empty space where the avatar would otherwise go.
This could lead to display inconsistencies, unwanted logging, or other
problems.

This change adds a new avatar service that's used as a fallback when no
other service is available. This will show the first two letters of the
username, overlayed on top of a colored background. The background color
is based on the username, helping to provide different visuals for
different users.

Consumers can replace the fallback with some other service by overriding
fallback_service_class on the registry.

To help with styling, both the existing avatars and the new ones have
new namespaced CSS classes (.djblets-o-avatar), which are meant to
replace the .avatar class (though this is still used).

Unit tests pass.

Tested various avatar sizes, making sure the fonts are in proportion.


Commits

Files

    Loading...