QueryAlterBase creates duplicate results in Views displaying content revisions on multilingual sites

Created on 26 March 2025, 19 days ago

Problem/Motivation

When content in a group is translated, the join added in the ensureDataTable() function that gets called in QueryAlterBase.php results in duplicated rows because it does not include langcode as a join condition.

Steps to reproduce

  • Fresh install of Drupal 10.4.5
  • Install and enable the following modules:
    • Core:
      • Block
      • Database Logging
      • Field
      • Field UI
      • Filter
      • Internal Dynamic Page Cache
      • Internal Page Cache
      • MySQL
      • Node
      • System
      • Update Manager
      • User
      • Views
      • Views UI
      • Options
      • Text
      • Language
      • Content translation
    • Contrib:
      • Entity 8.x-1.6
      • Flexible permissions 2.0.1
      • Group 3.3.4
  • Group Node
  • Under Configuration > Region and language > Language, add a second language to the site.
  • Create a new content type with “Create new revision” checked and translation enabled.
  • Create a new group type with the new content type enabled.
  • Create a group of the new group type.
  • Add a piece of content to the group, in the site’s default language.
  • Create a translation of the piece of content for the site’s second language.
  • Create a new view displaying content revisions with no filters.

At this point, the default language node should have two revisions, and the second language node one revision for a total of three revisions. However, six rows are returned by the view.

Proposed resolution

I attached a patch that fixed the issue on our site.

🐛 Bug report
Status

Active

Version

3.3

Component

Code

Created by

🇺🇸United States Amerie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024