Fix switching of view modes in text-type file attachment diffs.

Review Request #12430 — Created July 1, 2022 and submitted

Information

Review Board
release-4.0.x

Reviewers

The view mode selector ("rendered" vs "source") wasn't working when
viewing a diff of a text-based file attachment. We initially noticed
this with the Markdown review UI, but it affects all text-based
reviewables that support render modes. The issue here is that we were
passing in a root to Backbone.history that wasn't properly including
the diff file attachment ID. Because the root didn't match, the route
would never get triggered when the URL changed after the anchor was
clicked.

Viewed a markdown file attachment in both single-revision and diff
views. Verified that switching between "rendered" and "source" worked
properly for both.

Summary ID
Fix switching of view modes in text-type file attachment diffs.
The view mode selector ("rendered" vs "source") wasn't working when viewing a diff of a text-based file attachment. We initially noticed this with the Markdown review UI, but it affects all text-based reviewables that support render modes. The issue here is that we were passing in a `root` to `Backbone.history` that wasn't properly including the diff file attachment ID. Because the root didn't match, the route would never get triggered when the URL changed after the anchor was clicked. Testing Done: Viewed a markdown file attachment in both single-revision and diff views. Verified that switching between "rendered" and "source" worked properly for both.
73bc03caaf01feca405ea31a14c07c813ef2d1b3
Description From Last Updated

If we're going to use parens here, we can move the ? and : inside of it, aligned with the …

chipx86chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. Show all issues

    If we're going to use parens here, we can move the ? and : inside of it, aligned with the condition (the pattern we have elsewhere in the codebase).

  3. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (529faca)