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

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

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.

Summary ID
Fix non-image-based avatar display when replying to a review.
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.
a9c42f46f5ef72a71668f6929f6a204605d4938a
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (c1d5485)