Fix non-image-based avatar display when replying to a review.

Review Request #11325 — Created Dec. 8, 2020 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x

Reviewers

When replying to a review, we generate HTML intended to appear exactly
like a comment would appear when loading the page, but with indications
that it's a draft. This generally works well, but one noticeable issue
had to do with avatars.

If using the fallback avatar (or any custom avatar backend that used
HTML rather than images for display), the result would be a broken
image. This is because the HTML assumed the presence of image URLs for
avatars, rather than the empty strings that an HTML-only avatar would
return.

Since HTML-based avatar rendering is the path forward, we now provide a
rendered avatar in the base template as part of RB.UserSession, and
provide a convenient RB.UserSession.getAvatarHTML() as well. The reply
editor view uses this instead of URLs to do the rendering.

Tested a new reply with the HTML-only fallback avatar and with Gravatars.
In both cases, I got a proper avatar.

Unit tests pass.

Commits

Files

    Loading...