Problem/Motivation

From #2350939: Implement a generic revision UI, mentioned in summary/96/103/108/109/110.

To reduce duplicate code and maintenance burden, we should aim to rework Node's revision UI so it extends generic entity UI implemented in #2350939: Implement a generic revision UI

A generic revision UI is being implemented in #2350939: Implement a generic revision UI, this issue exists to deprecate/remove Node's revision UI in favor of the generic solution.

Proposed resolution

Remaining tasks

Postponed on #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider

  • Replace Node' revision UI code, extending generic revision UI.
  • Can we remove Node test coverage which already exists for generic revision UI?
  • Specific enhancements between generic UI and existing Node UI need to be identified, and add tests for this functionality.
  • Decide whether to keep yellow highlight, see #23 and linked comments
  • Decide how to work with Diff module, which has almost 60k reported installs which would need a update due to this issue
  • Out-of-scope: Move use admin theme out of node and into system. migrate config/schema. update _admin_route setoption in \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider::getVersionHistoryRoute to use the config value.

User interface changes

Issue aims to replicate existing interface, only removing the yellow background from first row.

Before:
before

After:strong>
before

API changes

Class names should be maintained, but extend generic classes.
Format of node render arrays and forms will change.

Data model changes

None?

Release notes snippet

-

Issue fork drupal-3153559

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

dpi created an issue. See original summary.

aaronmchale’s picture

Component: entity system » node system

Component should probably be "node system" in this case, since this issue will primarily impact the node module.

jibran’s picture

Title: [PP-1] Switch Node revision UI to generic UI » [PP-2] Switch Node revision UI to generic UI
Category: Feature request » Task
aaronmchale’s picture

I believe #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider could be done in parallel and wouldn't be a hard blocker because #2350939: Implement a generic revision UI provides a separate route provided dedicated to providing revision routes.

jibran’s picture

Yes, but both this issue and #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider will be deperecating some route defined in node.routing.yml which mean both issues are blocked on #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name.

aaronmchale’s picture

Yep that makes sense. So would that be [PP-3] now or still [PP-2], since yeah technically this issue is postponed on 3 issues, but as you said #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider depends on #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name anyway.

dpi’s picture

Issue summary: View changes

Padded summary.

acbramley’s picture

StatusFileSize
new7.17 KB
new119.42 KB

Here's a reroll of #7 on top of #2350939: Implement a generic revision UI (patch 134)

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.

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.

aaronmchale’s picture

#3043321: Use generic access API for node and media revision UI was committed, so this is not longer blocked on that issue; However it should probably be blocked on #3045358: [PP-1] Node module revision permission IDs are too generic.

aaronmchale’s picture

Title: [PP-2] Switch Node revision UI to generic UI » [PP-3] Switch Node revision UI to generic UI

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.

acbramley’s picture

StatusFileSize
new115.4 KB
aaronmchale’s picture

The latest patch in #2350939: Implement a generic revision UI adds this:

+/**
+ * Implements hook_local_tasks_alter().
+ */
+function node_local_tasks_alter(&$local_tasks) {
+  // Removes 'Revisions' local task added by deriver. Local task
+  // 'entity.node.version_history' will be replaced by
+  // 'entity.version_history:node.version_history' after
+  // https://www.drupal.org/project/drupal/issues/3153559.
+  unset($local_tasks['entity.version_history:node.version_history']);
+}

We should probably do something about this. I imagine the cleanest way would be to deprecate the entity.node.version_history local task and at the same time deprecate this hook implantation so that they are both removed.

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.

dpi’s picture

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

dpi’s picture

StatusFileSize
new7.71 KB
pasqualle’s picture

Is there a rule where to put the RouteProvider class? Core seems to have a mess. Would be nice to unify where these files should go, and use the correct directory in this patch.

content_moderation\src\Entity\Routing\EntityModerationRouteProvider.php
media\src\Routing\MediaRouteProvider.php
node\src\Entity\NodeRouteProvider.php
taxonomy\src\Entity\Routing\VocabularyRouteProvider.php
user\src\Entity\UserRouteProvider.php

should it be src\Entity\ or src\Routing\ or src\Entity\Routing\ directory?

dpi’s picture

Adding info from #2350939-261: Implement a generic revision UI + #2350939-277: Implement a generic revision UI re usability review of main entity revision UI issue, especially comparing existing node functionality vs work-in-progress MR. More detail/context is provided these linked comments.

When node to generic UI, we should revisit whether its necessary to retain the yellow background. It was introduced way back in #42072: Rework revisions overview screen, there doesnt seem to be much foundation/rationale for keeping it exactly as is. So we can decide whether to retain/rework/remove, and whether to move the styling to the theme, especially Claro.

We should also port the "Use admin theme" checkbox provided by node to entity generic, in system.module or similar. Specifically, move config schema, migrate existing node config, to system. Then update \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider::getVersionHistoryRoute to pull from this config.

dpi’s picture

Issue summary: View changes
catch’s picture

Title: [PP-3] Switch Node revision UI to generic UI » [PP-2] Switch Node revision UI to generic UI
dpi’s picture

Rebased onto and updated style to match #2350939: Implement a generic revision UI

berdir’s picture

Can we test what this does to the diff module?

daften’s picture

Status: Postponed » Active

Since #2350939: Implement a generic revision UI is fixed, this can be made active again I think.

andypost’s picture

Status: Active » Postponed
dpi’s picture

@andypost

My understanding with this is we don't actually need to deprecate routes, we can update the new NodeRevisionRouteProvider in the MR to use the same route ID's as found in existing node.routing.yml.

entity.node.revision and entity.node.version_history are fine as RevisionHtmlRouteProvider will generate the same IDs.

However RevisionHtmlRouteProvider has entity.$entityTypeId.revision_revert_form and entity.$entityTypeId.revision_delete_form for the revert and delete routes. Whereas the existing node routes are node.revision_revert_confirm and node.revision_delete_confirm.

We can override \Drupal\Core\Entity\Routing\RevisionHtmlRouteProvider::getRoutes with the legacy ID's, and if we really want can deprecate them. But its not really a requirement as far as I can tell.

Or is there something else I'm missing?

andypost’s picture

@dpi thank you! it makes sense but moreover except of routing it needs permission fix so at least one blocker #3045358: [PP-1] Node module revision permission IDs are too generic

the second is more about polishing #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider

jibran’s picture

I agree with @dpi let's not add a scope creep of deprecating the routes we can do that in #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider. Let's keep it a follow up task to #2350939: Implement a generic revision UI.

aaronmchale’s picture

#3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name should make deprecating routes possible.

Long-term it would be good if the node module followed the accepted pattern for route names, we could open a follow-up issue to this one and block #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider on it.

dpi’s picture

Though we aren't blocked on #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider as revision provider is a totally different class.

What are we actually postponed on?

andypost’s picture

catch’s picture

Title: [PP-2] Switch Node revision UI to generic UI » Switch Node revision UI to generic UI
Status: Postponed » Active

Since it's not clear what exactly is blocking this and what might be done in parallel, going to tentatively unpostpone - then if we do hit a hard blocker we can always re-postpone again.

aaronmchale’s picture

Though we aren't blocked on #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider as revision provider is a totally different class.

Agreed, I was thinking that in this issue we could just keep the route names the same as they are right now, then open a follow-up issue to change all the node route names which don't conform to the standard once #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name is done (so not just the revision routes). We could either postpone that follow-up issue on #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider, or the other way round, or maybe even do them in parallel.

aaronmchale’s picture

acbramley’s picture

Status: Active » Needs review

Latest commit should fix some of the revert failures (although very well may break other things). The local task failures are beyond me, those unit tests are voodoo magic.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

In the MR you say that entity.node.version_history is replaced but seems to not be getting picked up?

acbramley’s picture

Status: Needs work » Needs review

@smustgrave it is being picked up, the local task unit tests are failing for other reasons. Manually testing the patch shows the revisions route.

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

acbramley’s picture

Status: Needs review » Needs work

Was not meant to change back to NR - @VladimirAus are you going to be working on this?

acbramley’s picture

Latest commit should fix the local task tests. The theme handler is needed for the other local task deriver.

vladimiraus’s picture

@acbramley I'm testing it...

acbramley’s picture

Awesome! Thanks :)

acbramley’s picture

Pushed along some more failures, generally speaking the Node revision tests are a bit of a mess and there seems to be a lot of duplication across different test classes. I think this is going to take someone that knows the ins and outs of translations and the rest of it to really figure out how we are going to roll this out so it's not so disruptive. The functionality is changing quite a bit.

I've also added a pager to the generic revision UI controller as we were missing that and some of the Node based tests depended on it, I think it's a good idea to add one in any case.

aaronmchale’s picture

I've also added a pager to the generic revision UI controller as we were missing that and some of the Node based tests depended on it

I wonder if it would be better to do that in a separate issue, along with any changes to the generic implementation to support Node moving to it, then this issue is well scoped to only the changes needed in the Node module itself.

smustgrave’s picture

Fixed a few but still can't figure out what's wrong.

dpi’s picture

Lets get a screenshot comparison of the patch-to-date versus core as-is.

Do we need to deprecate \Drupal\node\Controller\NodeController::revisionOverview in some way?

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.

sumit saini’s picture

#3374607: Revision UI reverts all language translations when only one language is reverted should be fixed before switching to new revision UI to maintain existing behavior for reverting revisions of node translations.

acbramley’s picture

acbramley’s picture

Title: Switch Node revision UI to generic UI » [PP1] Switch Node revision UI to generic UI
acbramley’s picture

Title: [PP1] Switch Node revision UI to generic UI » [PP-2] Switch Node revision UI to generic UI
Related issues: +#3384725: Add pagination to VersionHistoryController

I'd say this would also be blocked on #3384725: Add pagination to VersionHistoryController

acbramley’s picture

Title: [PP-2] Switch Node revision UI to generic UI » [PP1] Switch Node revision UI to generic UI

Re #52 I have marked that postponed, I can't reproduce the issue.

Now I think this is only blocked by #2723579: NodeRouteProvider should extend DefaultHtmlRouteProvider

quietone’s picture

Issue summary: View changes

Adding what this is postponed on to the remaining tasks per Remining tasks.

quietone’s picture

Status: Needs work » Postponed
acbramley’s picture

Title: [PP1] Switch Node revision UI to generic UI » [PP2] Switch Node revision UI to generic UI
andypost’s picture

Title: [PP2] Switch Node revision UI to generic UI » [PP1] Switch Node revision UI to generic UI
amateescu’s picture

Title: [PP1] Switch Node revision UI to generic UI » Switch Node revision UI to generic UI
Status: Postponed » Needs work

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

sokru changed the visibility of the branch 10.1.x to hidden.

sokru changed the visibility of the branch 11.x to hidden.

sokru’s picture

Issue summary: View changes
Issue tags: -Needs screenshots
StatusFileSize
new90.79 KB
new88.14 KB

I created a new branch & merge request for Drupal 11.x. Basically just a reroll with few changes to legacy routes.

On issue summary:
- Added a remaining task for Diff module. Probably we don't want to remove the routes, but deprecate them, otherwise current Diff module users would face a fatal error on node/{nid}revisions route, due to https://git.drupalcode.org/project/diff/-/blob/2.x/src/Form/RevisionOver...
- Marked the "Use the administration theme when editing..." checkbox refactoring as Out-of-scope, since this issue is already rather hard to complete.
- Keeping or removing the yellow background for first row, would need a decision. Since there's no strong argument for keeping it, I'd suggest we remove it (currently on MR).
- Added screenshots with yellow background removal.

smustgrave’s picture

acbramley changed the visibility of the branch 3153559-core101-node-use-generic-revision-ui to hidden.

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

oily’s picture

Fixed PHPCS. Now there are a few tests failing. One is in NodeRevisionsTest.php. It concerns a missing 'revert' button so seems related to the issue. Though looking at the screenshots in the IS does not seem to be any removal of 'revert' buttons going on.

oily’s picture

Removed.

smustgrave’s picture

@oily because I get the emails. If you are going to post the test-only run it should also be with a code review please. Just running the test job and posting the results will not result in credit if that's the end goal and I've got a number of emails of just the posting. Again if you see me do 9/10 times I won't get credit either so just FYI

mstrelan’s picture

@oily we don't need the test-only job here, it's only useful for bug reports as it demonstrates the bug existed in HEAD and is fixed in the MR. Also, pasting its output only pollutes the issue and leads to more scrolling. Better to link to the job output if it's relevant.

oily’s picture

Re: #72 @smustgrave You told me that before and I heard you. As far as credit goes, you can see at #70 that I have already fixed PHPCS and as a result the pipeline has moved forward to the tests and lo ahd behold! several tests are failing. So they need to be fixed. Maybe not a huge amount of progress but progress, nevertheless? Or maybe not? How do I know? If I could wave a magic wand and become an expert contributor overnight with 500 credits not 66 credits, maybe i could contribute more to this issue or do what I do at a faster rate. I have waited 48 hours for @sokru to PHPCS his own work. (another rule I was told about?). I see that test-only was a wrong move,now. But I was trying to do a bit more that just fix PHPCS. I was hoping to fix at least one of the broken tests, too. But the test-only test set me off on the wrong path. Thanks for putting me right on that!

acbramley’s picture

The last failure is in NodeRevisionsUiTest::testNodeRevisionsTabWithDefaultRevision due to a behaviour change between the 2 revision overview controllers.

In NodeController::revisionOverview we have this:

// We treat also the latest translation-affecting revision as current
// revision, if it was the default revision, as its values for the
// current language will be the same of the current default revision in
// this case.
$is_current_revision = $revision->isDefaultRevision() || (!$current_revision_displayed && $revision->wasDefaultRevision());

Whereas in VersionHistoryController::buildRow we just check
$revision->isDefaultRevision()

We need to decide whether we want the behaviour change for Node, or for every other entity type using RevisionHtmlRouteProvider

acbramley’s picture

testRevisionTranslationRevert is also failing which uses another node specific revision route node.revision_revert_translation_confirm.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.