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

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


Review Board


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

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