Under the current node revisions overview logic, it is possible for a page of the revisions listing to show no revisions. This is confusing.

The NodeController->revisionsOverview() method reads in all revisions of the current node, and then filters them down according to whether the revision in question has a translation for the currently active language, and whether that revision translation is 'affected'. This was done in #2465907: Node revision UI reverts multiple languages when only one language should be reverted to address the issue of the revision UI reverting multiple translations when it shouldn't be.

Because the paging of the revisions query doesn't account for language and 'affected' state, it is possible for the revisions query to return a set of revisions for a node of which none of the revisions belong to the language being tested, nor are any of them marked as 'affected'. This filters the list down to zero, which results in an empty table of revisions for that page, which is confusing.

It's possible for this situation to arise on a site with many active languages. Given a site with 55 languages, if a node goes through translation, and there is a new revision for each language that is translated, it would be very possible for a given page of revisions to contain no revisions eligible for display.

The logic which filters down the returned page of revisions to the current language and 'affected' should be able to be pushed into the revision query itself (NodeController->getRevisionIds()). Since this is a protected method not called anywhere else, it should be safe to add these conditions to the query, to allow the pager to function properly.

Issue fork drupal-2916172

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

timcosgrove created an issue. See original summary.

timcosgrove’s picture

The attached patch works to rectify the situation. Review by those who know core better than me appreciated!

timcosgrove’s picture

Status: Active » Needs review
timmillwood’s picture

This sounds similar to #2769741: Node revisions page might not list a default revision.

In that issue there was a lot of discussion around what the expected behaviour is. I think we need to fully nail down what that expected behaviour is, and clear it with the UX team, then work with a test driven approach to nail down the behaviour in a test.

timcosgrove’s picture

It's somewhat similar, but for this case, the query that generates a page of 50 revisions doesn't take into account the further filtering that happens. All filtering should be part of the query if possible, so that the query is actually legitimate.

I have no strong opinion about #2769741: Node revisions page might not list a default revision though I think it's a legitimate issue. In this case, the query is simply badly constructed.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ahebrank’s picture

Reroll for 8.6 since I just ran into this on an older site.

Status: Needs review » Needs work

The last submitted patch, 10: 2916172_10_node_revision_overview_page-8.6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

johan.s’s picture

Attached patch for version 8.7.7

firewaller’s picture

+1

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

gantal’s picture

Issue tags: +DCCO2020

Tagging for DrupalCamp Colorado's upcoming contrib day.

johan.s’s picture

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

falco010’s picture

#17 successfully applied for me on 8.9.10 and solved the pagination issue for me. Our Drupal installation also has a lot of languages (30+) as described in the issue description.

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

Ignore this one.

anmolgoyal74’s picture

StatusFileSize
new7.02 KB

Adding the same patch for 9.2.x.

Status: Needs review » Needs work

The last submitted patch, 21: 2916172_21.patch, failed testing. View results

falco010’s picture

StatusFileSize
new953 bytes

All the above patches seem to break the work done in here:
https://www.drupal.org/project/drupal/issues/2938947
https://git.drupalcode.org/project/drupal/commit/41116a5

Which solved the issue that some revision lists would not have any "Current revision". This issue seems to be happening for me again now.
This might be because of this issue and the first patch was created earlier than the issue above.

All changes done in the NodeController.php in the patches above don't make any sense anymore and are not needed anymore. (tested this)
We can simplify the patch much more now, where we only have to change the query.

I will add a new patch where I revert all the changes in NodeController.php because they are not needed anymore.

I tested this new patch on 8.9.10 with 30+ languages and the pagination is working fine and it solves the "Current revision" issue (again) that I was having again.

golddragon007’s picture

I'm working currently on the https://www.drupal.org/project/drupal/issues/1863906 to see if I can fix there the issues, and I noticed that, it's not correct to use the `->condition($node->getEntityType()->getKey('revision_translation_affected'), '1')` condition, if you revert a translation to a previous version, then it won't be visible the current revision...

golddragon007’s picture

But it seems it works here properly, because of the custom conditions in the code regarding the latest version...
The #23 works fine, however @Falco010 can you remove the `if ($revision->hasTranslation($langcode) && $revision->getTranslation($langcode)->isRevisionTranslationAffected()) {` as it become useless.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

falco010’s picture

Priority: Normal » Major
Status: Needs work » Needs review
StatusFileSize
new981 bytes

Rerolling for 9.2.x

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

immaculatexavier’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed whether the old patch still applies to the latest code and passes automated tests.

Steps taken to review:

Downloaded the latest patch file.

  1. Used Git to clone local Git repository of 9.3.x of the development version that the issue pertains to.
  2. The patch #27 applied successfully.
  3. The automated tests for the project were re-run after I clicked the "retest" link in the patch file, the automated test passed successfully.

Result:

Verified the patch applied successfully, and the automated test passed successfully.

immaculatexavier’s picture

Status: Reviewed & tested by the community » Needs review

Changed to Need review for other test scenarios

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

heddn’s picture

Status: Needs review » Needs work
+++ b/core/modules/node/src/Controller/NodeController.php
@@ -299,10 +299,13 @@ public function addPageTitle(NodeTypeInterface $node_type) {
+    $langcode = $node->language()->getId();

There's still some oddness going on here. If a specific translation doesn't exist and one visits the revisions tab, the langcode returned is for the default language, not the interface language. I think we should make that more obvious in the UI somehow. Maybe we need to list the language as the default instead? Alternatively, filter here by the interface language and show zero revisions.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

recrit’s picture

Regarding #33, using the node language will be the correct language once the loaded node is correct for the interface language per #3092558: Revisions log on translated nodes should not show original language revisions, should show revisions of translated content

recrit’s picture

Status: Needs work » Needs review
needs-review-queue-bot’s picture

Status: Needs review » Needs work

The Needs Review Queue Bot tested this issue.

While you are making the above changes, we recommend that you convert this patch to a merge request. Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

romixua made their first commit to this issue’s fork.

samit.310@gmail.com made their first commit to this issue’s fork.

samitk’s picture

Status: Needs work » Needs review

romixua changed the visibility of the branch 2916172-node-revision-ui to hidden.

romixua’s picture

By adding addMetaData('langcode', $langcode) we fix this issue and provide correct check by nodes grants

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update, +Needs tests

Issue summary appears incomplete, recommend using the standard issue template.

Also can a test case be added for this scenario to show the problem.

acbramley’s picture

Status: Needs work » Closed (duplicate)

This is a duplicate of #2722307: Move translation based conditions into database query on revisions overview page I'll close this one as work has been started over there with a more fleshed out solution.

lisotton’s picture

Status: Closed (duplicate) » Needs work

@acbramley I do not agree that #2722307 is a better solution. There the behavior has completely changed and not only the affected revisions are displayed.

With patch provided by @falco010 in #27, it is only filtering at the query level, but the same revisions are displayed as before, but we don't have empty pages anymore.

@romixua your suggestion did not work, I tried to apply the patch your provided in the MR, but I will have empty pages.

acbramley’s picture

Status: Needs work » Closed (duplicate)

Hi @lisotton I understand where you're coming from but:
1. That issue also includes the langcode filter
2. There's no reason to have 2 issues open that touch the same code in similar ways. If we find in that issue that we don't want to remove the affected revisions check then we will remove it there, meaning it is exactly the same as this issue. Having both issues open is just splitting effort and making it confusing for contributors.

We should focus efforts on a single issue and since this one has the least recent activity and the MR is not up to date I think we should still close this one.

Please provide testing and feedback on #2722307: Move translation based conditions into database query on revisions overview page.