Problem/Motivation

The comparison route for nodes "diff.revisions_diff" loads the default revision in the default revision's language. This causes a bug when viewing the revision comparison for a translation. The navigation incorrectly allows navigating to next / previous changes of revisions that are not for the translation in the current content language.

Steps to reproduce

  • Create a node in the default language, example English.
  • Create some revisions for the English translation.
  • Add a Spanish translation
  • Create some revisions for the Spanish translation
  • View the Revisions for the Spanish translation. Note: Test with #3092558: Revisions log on translated nodes should not show original language revisions, should show revisions of translated content which has been merged now. This limits the revisions to only revisions for the current content language.
  • Compare two revisions of the Spanish translation.
  • Click the "Previous Change" link in the Diff comparison Navigation.
  • Bug: You will be able to navigate through all revisions - English and Spanish.

Proposed resolution

Load the latest entity in the current content language so that the Drupal\diff\Controller\PluginRevisionController has the correct language to build the revision IDs for the navigation.

User interface changes

None.

API changes

None.

Data model changes

None.

CommentFileSizeAuthor
#2 diff-3418174-2-load-latest.patch1.16 KBrecrit

Comments

recrit created an issue. See original summary.

recrit’s picture

Status: Active » Needs review
StatusFileSize
new1.16 KB

The patch attached loads the latest revision for the "diff.revisions_diff" route and the dynamic routes using the DiffRouteProvider.

heddn’s picture

Version: 8.x-1.x-dev » 2.x-dev
Status: Needs review » Needs work

For this to be reviewed and accepted, please review https://git.drupalcode.org/project/diff#contribution-guidelines. Since this is an older contribution, it could need a reroll/rebase. Additionally, we'll need an MR opened and some tests.