Problem/Motivation
Revision overview screens (both Node and the generic revision UI) load revisions via a database query and then contain additional conditions to only show revisions where isRevisionTranslationAffected returns TRUE.
This presents a number of issues such as hiding the real "current" revision when that flag is NULL, or in some cases showing a completely empty revisions page because the database query returns 50 revisions that are all marked as un-affected (see related issues).
Original report
#2713587: NodeController::revisionOverview() shows no revisions if node has no translation for current language brought up again that we have a conflict between trying to show only translation-relevant content in places like admin listings, vs. showing people the full history of nodes. This is also a conflict between trying to maintain the original UX of translation sets from 6/7 vs. the field translation approach.
Overall I think the revision tab should show all edits to a node regardless of affected language. For example how else would you undo adding a translation except reverting to the revision just before? We could then have a per-language filter on the page to show only affected languages. Or two tab
Proposed resolution
1. Remove $revision->hasTranslation($currentLangcode) && $revision->getTranslation($currentLangcode)->isRevisionTranslationAffected() conditions in VersionHistoryController::loadRevisions and NodeController::revisionOverview.
2. Add langcode and revision_translation_affected conditions directly to the database queries which load the revisions.
Remaining tasks
Agree on direction
Review
User interface changes
None
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #41 | Screenshot from 2025-09-18 14-15-29.png | 30.92 KB | acbramley |
Issue fork drupal-2722307
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:
- 2722307-consider-showing-all
changes, plain diff MR !12274
Comments
Comment #2
mkalkbrennerJust showing all revisions is not a solution. That will reintroduce all the issues we fixed by limiting the shown revisions to the affected ones.
A bit of history:
What could be discussed is a language selector or a separate tab.
I already proposed something like that but finally webchick decided to go for the current solution because it "simulates" the D7 behavior where revisions of translations where decoupled.
Comment #3
catchWhile that's true in the case of what core offered, a lot of multilingual 7.x sites (like all the ones I've worked on) use entity_translation which shows everything together. Part of the reason we moved from translation sets to field/entity translation was because the separate nodes was not working well.
Comment #4
mkalkbrenner@catch: I think we're basically of the same opinion.
There are both use-cases, one to show all revisions regardless of their translation, and another one to filter the revision to those that are really affected by the currently shown translation.
As far as I remember we agreed on a 20% vs. 80% split of these use-cases which was the reason for the current implementation.
To repeat one of my proposals:
Introduce a new tab that shows all revisions regardless of their translations and split the right "revert all revisions" into two rights (one for each tab) to have to possibility to hide the new tab for editors.
BTW In Revision UI we created a prototype that not just deitinguishes between translations but let you select the concrete fields you want to revert.
Comment #5
berdirOne thing to consider is modules like https://www.drupal.org/project/paragraphs.
Technically, that works with untranslatable reference fields. But as far as the user is concerned, it is translatable (we store the same reference and maintain translations of the referenced paragraph entities within the widget)
That's currently pretty weird with the core revision UI, as you have to check the untranslatable checkbox to have your "translatable" paragraphs reverted, and I've also had troubles getting revisions to show up as expected when you just change paragraphs.
Comment #6
yoroy commentedI don't understand comment #5 :) but besides that I don't see any arguments against showing all revisions, only that we have to design how to do it.
A screenshot of how Revision does things could be helpful.
Comment #7
yoroy commentedComment #22
liam morlandAnother related problem at would be solved by this: The paging is done in
NodeController::getRevisionIds(); that returns 50 revisions at a time. Then in::revisionOverview(), some of the revisions may be skipped. This can result in an empty results page. I've seen a pager with several pages, but only two revisions that actually appear anywhere.Comment #23
acbramley commentedIs this something we still can/want to/should consider?
Comment #24
catchI think we should do this.
A language selector would allow for a closer equivalent to the current behaviour for people that need it, but the page just does not properly work as it currently is, so I think we could open a separate issue to add that, and keep things simple here.
Comment #25
acbramley commentedAdded related/dupe issues for core and Diff. I think the main issue here is the
isRevisionTranslationAffectedcheck.The generic revision UI also has this same check in VersionHistoryController::loadRevisions. Whatever fix we do for Node should apply there too.
Agreed that we should keep this one simple and potentially add a language filter in another issue if needed.
Comment #26
acbramley commentedThese conditions were added in #2465907: Node revision UI reverts multiple languages when only one language should be reverted so it will be crucial we don't regress on that bug
Commit https://git.drupalcode.org/project/drupal/-/commit/7940793ae0bbfdb64fb5e...
Comment #27
acbramley commentedAfter debugging this more it's clear that the current code is definitely masking some pretty weird issues.
E.g set up the following:
1. Install standard
2. Install content_translation module
3. Add another language (e.g Dutch)
4. Edit Basic page content type and mark it translatable
5. Create a node, then translate it to the new language, adding a revision log of "create LANGUAGE revision".
At this point this will create 2 new revisions - one for English and one for Dutch. The English one will be marked with
revision_translation_affected = NULLThe node_revision table will have 2 records, but node_field_revision will have 3. 2 of those will be for vid 2, one for each language. Vid 2 for english will have values copied from vid 1 (i.e created/changed dates).
Since the revision_log field is not translateable, the node_revision table will have "create LANGUAGE revision" for vid 2, which is the default revision for english.
6. Go to node/1/revisions (i.e the English revisions page). You'll see 1 revision marked as current, but this is actually revision 1. You won't see a revision log message, which IMO is incorrect. The reason this is incorrectly shown as the current revision is because of this code:
Comment #29
acbramley commentedThis is green now.
Want to get a review on the code changes before going ahead with a full IS update + CR.
Comment #30
smustgrave commentedCan the summary be updated with what’s being proposed? Do we want a page with all revisions loaded? What if it’s 1000s of revisions
Comment #31
acbramley commented@smustgrave did you see #29?
No, we still paginate revisions.
Comment #32
smustgrave commentedYea but without a clear summary hard to review the code as it wasn’t clear what the we being accomplished
Comment #33
smustgrave commentedAny recommended way for testing this one?
Comment #34
acbramley commented@smustgrave it's a bit tricky because you have to generate revisions that are marked as non translation affecting.
The easiest way to do that is programatically generate some revisions similar to the tests.
Comment #35
smustgrave commentedRan test-only feature
Tried to do the same as the tests manually but ended up borking it so going to lean on the test coverage here.
But overall believe this one is good and don't see any open items for it. Going to mark.
Comment #36
quietone commentedIs there a follow up for the point raised by catch in #24?
@smustgrave, thanks for asking for an issue summary update, that is really helpful.
I have updated credit.
Comment #37
quietone commentedUsing Umami, I created a new content type and created an English node. When a Spanish translation was added the English revision tab showed a new revision. Seeing this in action and from an editor perspective that was unexpected because the English version of the node was not changed. I added another language, bringing the total to 3. And confirmed that every save to the node in another language caused a revision to appear on the English language revision page. In my limited testing the English version revision page shows 7 revisions with this change and 1 revision without this change. That does reflect the database but will it make sense to the editor?
Like @smustgrave, I wasn't able to reproduce the test from the UI. So, I can't confirm what the test is doing. The test alone went from 2 revisions to 5 revisions displayed.
I would like to know more about how this will effect editors. There will definitely by an increase in the number of revisions shown on the revision tab for the default site language. And for a site with many languages and revisions on a node that is surely going to be a surprise. This would need a CR to explain that, I think.
So, if I am following this correctly then there should be a UX review of this.
Comment #38
quietone commentedShould be needs work for the usability review and a change record, and maybe even doc updates. I did bring this up with the other committers.
Comment #39
acbramley commentedI agree it's quite a large change, but if you look at all the related issues and #27 you'll see the current situation is really not ideal. I'd rather see more detail than not be able to see what's actually going on.
I think the reason why we see new revisions for the default language is because revisions are created for the default language as well?
Comment #40
acbramley commentedrevisiting this with fresh eyes I realised we needed to filter by
revision_translation_affected, adding that means we are back to where we were in terms of revision displays (tests pass with no changes). Now we need test coverage for what we're fixing (e.g broken pagers with a lot of unaffected revisions)Comment #41
acbramley commentedAdded test coverage for the issue, here's what the revisions page looks like on HEAD in that test case:
Comment #42
acbramley commentedNow expanded to the generic revision UI as well.
Same failure as #41 with test-only changes "0 elements matching css "table tbody tr" found on the page, but should be 50."
Comment #43
rosk0Thanks for pushing it forward Adam!
Changes looks good and test coverage added. Patch applied to existing project and tested. All looks to be OK.
Comment #44
liam morlandComment #46
acbramley commentedComment #47
alexpottThis looks pretty good to me - just a few questions / thoughts on the MR.
I think the issue summary needs an update as the solution in the MR and issue summary seem to have diverged.
Comment #48
acbramley commentedComment #49
alexpottI think this is good to go. Just fixed the issue summary to be inline with the MR.
Comment #51
rosk0I believe this is ready. Thanks everyone!
Comment #52
alexpottCommitted and pushed aab88182a75 to main and 2e92f41d915 to 11.x and 4d6098cd456 to 11.3.x. Thanks!
I've backported to 11.3.x as this only make changes to behaviours of controllers which are not part of our BC policy and it does not make any API changes and it does fix a bug.
Comment #55
acbramley commented@alexpott it doesn't look like the commits were pushed to main and 11.x? They aren't linked here on the issue and when pulling locally I can't see the changes on those branches.
Comment #59
paul121 commentedThis change broke the Version History "Revisions" page for our custom entity types that do not include a
revision_data_table. The revision page works after defining therevision_data_tableand doing a fresh install, but not after simply doing a cache rebuild. See error details below.Interestingly, there was a change to the entity type the
RevisionVersionHistoryTesttest is using: https://git.drupalcode.org/project/drupal/-/commit/4d6098cd4564f7d52f4d4... It was previously usingEntityTestRevwhich does not define arevision_data_table, but now it usesEntityTestMulRevwhich does define arevision_data_table.. !So... it is not clear to me if
revision_data_tableis a required attribute for revisionable content entity types?? If it is not required, then I think this issue introduced a breaking change.Unfortunately, I cannot find good documentation about what is required with
revision_data_table. This doc page Making an entity revisionable does not mentionrevision_data_table. FWIW our custom entity type that does not include this has been working fine for many years.Comment #60
acbramley commented@paul121 it looks like that would only happen if the entity type is translatable AND does not have a revision_data_table since it looks like that is coming from the
revision_translation_affectedcondition? I'm not entirely sure if that should be required or not, can you open a separate issue to address this?Comment #61
m.stentaI can confirm that we ran into this error with the Log entity module. It is impossible to view Log entity revisions.
I opened a follow-up issue: #3596981: Uncaught PHP Exception: revision_translation_affected not found